Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

feat(paste):responsive-ui

Aswin Asokd1b97df93bb2
diff --git a/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx b/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
index e930d89928..cd4834497f 100644
--- a/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteCreatePanel.tsx
@@ -43,210 +43,220 @@ export const PasteCreatePanel = ({
return (
<>
- <Box
- sx={{
- position: "relative",
- width: "100%",
- }}
- >
- <TextField
- variant="filled"
- hiddenLabel
- fullWidth
- slotProps={{
- input: { disableUnderline: true },
- htmlInput: { maxLength: MAX_PASTE_CHARS },
- }}
- multiline
- minRows={5}
- maxRows={12}
- placeholder="Paste text (keys, snippets, notes, instructions...)"
- value={inputText}
- onChange={(event) => {
- onInputChange(event.target.value);
+ <Box
+ sx={{
+ position: "relative",
+ width: "100%",
+ maxWidth: "100%",
+ minWidth: 0,
}}
- sx={[
- pasteTextFieldSx(
- "20px",
- inputGlassBg,
- inputGlassBorder,
- ),
- {
- "& .MuiFilledInput-root": {
- paddingBottom: "84px",
- backdropFilter: "blur(9px) saturate(112%)",
- WebkitBackdropFilter: "blur(9px) saturate(112%)",
- background:
- "linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
- boxShadow:
- "0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
- "&:hover": {
- bgcolor: inputGlassBg,
- borderColor: inputGlassBorder,
+ >
+ <TextField
+ variant="filled"
+ hiddenLabel
+ fullWidth
+ slotProps={{
+ input: { disableUnderline: true },
+ htmlInput: { maxLength: MAX_PASTE_CHARS },
+ }}
+ multiline
+ minRows={5}
+ maxRows={12}
+ placeholder="Paste text (keys, snippets, notes, instructions...)"
+ value={inputText}
+ onChange={(event) => {
+ onInputChange(event.target.value);
+ }}
+ sx={[
+ pasteTextFieldSx(
+ "20px",
+ inputGlassBg,
+ inputGlassBorder,
+ ),
+ {
+ "& .MuiFilledInput-root": {
+ paddingBottom: { xs: "76px", sm: "84px" },
+ padding: { xs: "12px", sm: "14px" },
+ backdropFilter: "blur(9px) saturate(112%)",
+ WebkitBackdropFilter: "blur(9px) saturate(112%)",
background:
"linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
boxShadow:
"0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
+ "&:hover": {
+ bgcolor: inputGlassBg,
+ borderColor: inputGlassBorder,
+ background:
+ "linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
+ boxShadow:
+ "0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
+ },
+ "&.Mui-focused": {
+ bgcolor: inputGlassBg,
+ borderColor: inputGlassBorder,
+ background:
+ "linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
+ boxShadow:
+ "0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
+ },
},
- "&.Mui-focused": {
- bgcolor: inputGlassBg,
- borderColor: inputGlassBorder,
- background:
- "linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 58%, rgba(255, 255, 255, 0.015) 100%)",
- boxShadow:
- "0 12px 28px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1)",
+ "& .MuiInputBase-input": {
+ fontSize: { xs: "0.98rem", sm: "1.05rem" },
+ lineHeight: 1.6,
},
},
- "& .MuiInputBase-input": {
- fontSize: "1.05rem",
- lineHeight: 1.6,
- },
- },
- ]}
- />
- <Box
- sx={{
- position: "absolute",
- left: 18,
- right: 18,
- bottom: 18,
- height: 48,
- display: "flex",
- justifyContent: "space-between",
- alignItems: "flex-end",
- gap: 2,
- pointerEvents: "none",
- }}
- >
- <Typography
- variant="mini"
+ ]}
+ />
+ <Box
sx={{
+ position: "absolute",
+ left: { xs: 12, sm: 18 },
+ right: { xs: 12, sm: 18 },
+ bottom: { xs: 12, sm: 18 },
+ height: { xs: 44, sm: 48 },
display: "flex",
- alignItems: "center",
- height: 44,
- transform: { xs: "translateY(10px)", md: "translateY(12px)" },
- color: mutedCounterColor,
- fontWeight: 600,
- lineHeight: 1,
- letterSpacing: "0.01em",
+ justifyContent: "space-between",
+ alignItems: "flex-end",
+ gap: { xs: 1, sm: 2 },
+ pointerEvents: "none",
}}
>
- <Box
- component="span"
+ <Typography
+ variant="mini"
sx={{
- color: isNearCharLimit
- ? softBlueCounterColor
- : mutedCounterColor,
+ display: "flex",
+ alignItems: "center",
+ height: { xs: 40, sm: 44 },
+ transform: {
+ xs: "translateY(8px)",
+ md: "translateY(12px)",
+ },
+ color: mutedCounterColor,
+ fontWeight: 600,
+ lineHeight: 1,
+ letterSpacing: "0.01em",
}}
>
- {inputText.length}
- </Box>
- <Box component="span" sx={{ color: mutedCounterColor }}>
- /{MAX_PASTE_CHARS}
- </Box>
- </Typography>
- <IconButton
- aria-label="Create secure link"
- onClick={() => {
- void onCreate();
- }}
- disabled={creating || isInputEmpty}
- sx={{
- pointerEvents: "auto",
- width: 44,
- height: 44,
- borderRadius: "14px",
- bgcolor: frameBlue,
- color: "#f4f7ff",
- boxShadow: "none",
- "&:hover": {
+ <Box
+ component="span"
+ sx={{
+ color: isNearCharLimit
+ ? softBlueCounterColor
+ : mutedCounterColor,
+ }}
+ >
+ {inputText.length}
+ </Box>
+ <Box component="span" sx={{ color: mutedCounterColor }}>
+ /{MAX_PASTE_CHARS}
+ </Box>
+ </Typography>
+ <IconButton
+ aria-label="Create secure link"
+ onClick={() => {
+ void onCreate();
+ }}
+ disabled={creating || isInputEmpty}
+ sx={{
+ pointerEvents: "auto",
+ width: { xs: 40, sm: 44 },
+ height: { xs: 40, sm: 44 },
+ borderRadius: { xs: "12px", sm: "14px" },
bgcolor: frameBlue,
+ color: "#f4f7ff",
boxShadow: "none",
- },
- "&.Mui-disabled": {
- bgcolor: isInputEmpty
- ? "rgba(255, 255, 255, 0.18)"
- : "rgba(47, 109, 247, 0.45)",
- color: isInputEmpty
- ? "rgba(230, 236, 255, 0.44)"
- : "rgba(244, 247, 255, 0.72)",
- },
- }}
- >
- <Box
- sx={{
- transform: "rotate(90deg)",
- display: "flex",
+ "&:hover": {
+ bgcolor: frameBlue,
+ boxShadow: "none",
+ },
+ "&.Mui-disabled": {
+ bgcolor: isInputEmpty
+ ? "rgba(255, 255, 255, 0.18)"
+ : "rgba(47, 109, 247, 0.45)",
+ color: isInputEmpty
+ ? "rgba(230, 236, 255, 0.44)"
+ : "rgba(244, 247, 255, 0.72)",
+ },
}}
>
- <HugeiconsIcon
- icon={Navigation06Icon}
- size={20}
- strokeWidth={2}
- />
- </Box>
- </IconButton>
+ <Box
+ sx={{
+ transform: "rotate(90deg)",
+ display: "flex",
+ }}
+ >
+ <HugeiconsIcon
+ icon={Navigation06Icon}
+ size={18}
+ strokeWidth={2}
+ />
+ </Box>
+ </IconButton>
+ </Box>
</Box>
- </Box>
- <Box
- sx={{
- mt: { xs: "84px", md: "116px" },
- display: "flex",
- flexDirection: "column",
- alignItems: "center",
- textAlign: "center",
- }}
- >
<Box
sx={{
+ mt: { xs: "72px", sm: "84px", md: "116px" },
display: "flex",
- flexWrap: { xs: "wrap", md: "nowrap" },
- justifyContent: "center",
- gap: 1,
- maxWidth: { xs: 520, md: "none" },
- mb: "3rem",
- pointerEvents: "none",
- userSelect: "none",
+ flexDirection: "column",
+ alignItems: "center",
+ textAlign: "center",
+ width: "100%",
+ maxWidth: "100%",
}}
>
- {privacyPills.map((label) => (
- <Box
- key={label}
- component="span"
- aria-disabled="true"
- sx={{
- px: 1.4,
- py: 0.6,
- borderRadius: "999px",
- border: "1px solid rgba(147, 155, 177, 0.24)",
- bgcolor: "rgba(255, 255, 255, 0.045)",
- color: "rgba(220, 229, 255, 0.55)",
- fontSize: "0.79rem",
- fontWeight: 600,
- letterSpacing: "0.01em",
- lineHeight: 1.2,
- whiteSpace: "nowrap",
- boxShadow: "inset 0 1px 0 rgba(255, 255, 255, 0.05)",
- opacity: 0.78,
- }}
- >
- {label}
- </Box>
- ))}
+ <Box
+ sx={{
+ display: "flex",
+ flexWrap: "wrap",
+ justifyContent: "center",
+ gap: { xs: 0.7, sm: 1 },
+ width: "100%",
+ maxWidth: { xs: "100%", sm: 520, md: "none" },
+ mb: { xs: "2rem", sm: "3rem" },
+ pointerEvents: "none",
+ userSelect: "none",
+ }}
+ >
+ {privacyPills.map((label) => (
+ <Box
+ key={label}
+ component="span"
+ aria-disabled="true"
+ sx={{
+ px: { xs: 1.2, sm: 1.4 },
+ py: { xs: 0.45, sm: 0.6 },
+ borderRadius: "999px",
+ border: "1px solid rgba(147, 155, 177, 0.24)",
+ bgcolor: "rgba(255, 255, 255, 0.045)",
+ color: "rgba(220, 229, 255, 0.55)",
+ fontSize: { xs: "0.74rem", sm: "0.79rem" },
+ fontWeight: 600,
+ letterSpacing: "0.01em",
+ lineHeight: 1.2,
+ whiteSpace: "nowrap",
+ boxShadow:
+ "inset 0 1px 0 rgba(255, 255, 255, 0.05)",
+ opacity: 0.78,
+ }}
+ >
+ {label}
+ </Box>
+ ))}
+ </Box>
</Box>
- </Box>
- {createError && <Typography color="error">{createError}</Typography>}
+ {createError && <Typography color="error">{createError}</Typography>}
- {createdLink && (
- <Box sx={{ mt: { xs: 4.4, sm: 5.2 } }}>
- <PasteLinkCard
- link={createdLink}
- onCopy={onCopyLink}
- onShare={onShareLink}
- />
- </Box>
- )}
+ {createdLink && (
+ <Box sx={{ mt: { xs: 4.4, sm: 5.2 }, width: "100%", minWidth: 0 }}>
+ <PasteLinkCard
+ link={createdLink}
+ onCopy={onCopyLink}
+ onShare={onShareLink}
+ />
+ </Box>
+ )}
</>
);
};
diff --git a/web/apps/paste/src/features/paste/components/PasteFrame.tsx b/web/apps/paste/src/features/paste/components/PasteFrame.tsx
index 7d54e6055c..3a7f375d1a 100644
--- a/web/apps/paste/src/features/paste/components/PasteFrame.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteFrame.tsx
@@ -11,13 +11,16 @@ export const PasteFrame = ({ children, footer }: PasteFrameProps) => (
<Box
sx={{
minHeight: "100dvh",
+ width: "100%",
+ maxWidth: "100%",
bgcolor: "#2f6df7",
fontFamily: '"Inter Variable", sans-serif',
display: "flex",
flexDirection: "column",
- alignItems: "center",
+ alignItems: "stretch",
p: { xs: 1.25, md: 2 },
boxSizing: "border-box",
+ overflowX: "hidden",
}}
>
<Box
@@ -29,12 +32,14 @@ export const PasteFrame = ({ children, footer }: PasteFrameProps) => (
},
flex: 1,
width: "100%",
+ maxWidth: "100%",
bgcolor: "#0d1016",
borderRadius: { xs: "24px", md: "34px" },
display: "grid",
gridTemplateRows: "auto 1fr auto",
alignItems: "stretch",
boxShadow: "inset 0 0 0 1px rgba(255, 255, 255, 0.04)",
+ overflowX: "hidden",
"& ::selection": {
backgroundColor: "#2f6df7",
color: "#ffffff",
diff --git a/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx b/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
index 7522f45ffb..8a99fbd980 100644
--- a/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteLinkCard.tsx
@@ -296,6 +296,9 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
ref={linkCardRef}
spacing={1}
sx={{
+ width: "100%",
+ maxWidth: "100%",
+ minWidth: 0,
scrollMarginTop: {
xs: "16px",
md: "24px",
@@ -308,6 +311,7 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
fontWeight: 600,
letterSpacing: "0.01em",
color: "rgba(220, 229, 255, 0.76)",
+ maxWidth: "100%",
}}
>
One-Time Link
@@ -316,12 +320,27 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
direction={{ xs: "column", sm: "row" }}
spacing={1}
alignItems={{ xs: "stretch", sm: "center" }}
- sx={{ minWidth: 0 }}
+ sx={{
+ width: {
+ xs: "calc(100vw - 4rem)",
+ sm: "100%",
+ },
+ maxWidth: { xs: "24rem", sm: "100%" },
+ minWidth: 0,
+ mx: "auto",
+ position: "relative",
+ zIndex: 1,
+ }}
>
<Box
sx={{
+ width: "100%",
+ maxWidth: "100%",
flex: 1,
minWidth: 0,
+ display: "flex",
+ alignItems: "center",
+ boxSizing: "border-box",
px: { xs: 1.9, sm: 2.2 },
py: { xs: 1.05, sm: 1.2 },
borderRadius: "14px",
@@ -330,6 +349,7 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
backdropFilter: "blur(8px) saturate(108%)",
WebkitBackdropFilter: "blur(8px) saturate(108%)",
boxShadow: "inset 0 1px 0 rgba(255, 255, 255, 0.08)",
+ overflow: "hidden",
}}
>
<Typography
@@ -341,32 +361,46 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
sx={{
display: "flex",
alignItems: "center",
- justifyContent: "center",
+ justifyContent: { xs: "flex-start", md: "center" },
+ height: "100%",
+ width: "100%",
+ maxWidth: "100%",
gap: 0.9,
minWidth: 0,
color: "rgba(244, 247, 255, 0.9)",
textDecoration: "none",
- fontSize: "0.93rem",
+ fontSize: { xs: "0.9rem", sm: "0.93rem" },
lineHeight: 1.4,
- textAlign: "center",
+ textAlign: "left",
overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "nowrap",
"&:hover": {
textDecoration: "underline",
color: "rgba(244, 247, 255, 1)",
},
}}
>
- <HugeiconsIcon
- icon={Link01Icon}
- size={17}
- strokeWidth={1.9}
- />
+ <Box
+ sx={{
+ width: 20,
+ height: 20,
+ display: "grid",
+ placeItems: "center",
+ flexShrink: 0,
+ alignSelf: "center",
+ }}
+ >
+ <HugeiconsIcon
+ icon={Link01Icon}
+ size={17}
+ strokeWidth={1.9}
+ />
+ </Box>
<Box
component="span"
sx={{
+ flex: { xs: 1, md: "0 1 auto" },
minWidth: 0,
+ maxWidth: { md: "calc(100% - 28px)" },
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
@@ -377,24 +411,80 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
</Box>
</Typography>
</Box>
+ {arrow && (
+ <Box
+ sx={{
+ display: { xs: "block", sm: "none" },
+ position: "absolute",
+ left: { xs: 18 },
+ top: "100%",
+ mt: "-22px",
+ width: 132,
+ height: "auto",
+ zIndex: 3,
+ pointerEvents: "none",
+ transform: "rotate(24deg)",
+ transformOrigin: "50% 50%",
+ }}
+ >
+ <svg
+ viewBox={`0 0 ${arrow.width} ${arrow.height}`}
+ width="100%"
+ height="100%"
+ fill="none"
+ aria-hidden="true"
+ focusable="false"
+ >
+ <g transform={arrow.transform}>
+ {arrow.paths.map((path, idx) => (
+ <path
+ key={`${path.d}-mobile-${idx}`}
+ d={path.d}
+ fill="none"
+ stroke={path.color}
+ strokeWidth={path.width * path.strokeScale}
+ strokeLinecap={path.lineCap}
+ strokeLinejoin={path.lineJoin}
+ />
+ ))}
+ </g>
+ </svg>
+ </Box>
+ )}
</Stack>
<Box
sx={{
display: "flex",
- alignItems: "center",
- justifyContent: "flex-start",
- gap: { xs: 0.75, sm: 1.1 },
- pl: { xs: 0, sm: 0.5 },
- mt: { xs: 0.8, sm: 1.1 },
+ alignItems: { xs: "center", sm: "center" },
+ justifyContent: {
+ xs: "flex-start",
+ sm: "flex-start",
+ md: "center",
+ },
+ flexDirection: { xs: "column", sm: "row" },
+ gap: { xs: 0.45, sm: 1.1 },
+ pl: { xs: 0, sm: 0.5, md: 0 },
+ mt: { xs: 2.5, sm: 1.1 },
opacity: 0.9,
+ width: "100%",
+ maxWidth: "100%",
+ minWidth: 0,
+ overflow: "visible",
}}
>
{arrow && (
<Box
sx={{
- width: { xs: 132, sm: 178, md: 212 },
+ display: { xs: "none", sm: "block" },
+ width: { sm: 178, md: 212 },
height: "auto",
- transform: "rotate(28deg)",
+ alignSelf: "auto",
+ ml: 0,
+ mt: { sm: 0.35, md: 0.25 },
+ mb: { sm: 0, md: 0 },
+ position: "relative",
+ zIndex: 4,
+ transform: "translateY(8px) rotate(28deg)",
transformOrigin: "50% 50%",
pointerEvents: "none",
}}
@@ -428,8 +518,16 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
)}
<Stack
direction="row"
- spacing={{ xs: 2.7, sm: 3.2 }}
+ spacing={{ xs: 1.2, sm: 3.2 }}
alignItems="flex-end"
+ justifyContent={{ xs: "flex-start", sm: "flex-start" }}
+ sx={{
+ width: { xs: "100%", sm: "auto" },
+ maxWidth: { xs: 220, sm: "none" },
+ pl: { xs: 0, sm: 0 },
+ mx: { xs: "auto", sm: 0 },
+ transform: { xs: "translate(58px, 48px)", sm: "none" },
+ }}
>
<Typography
component="button"
@@ -439,7 +537,7 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
sx={{
fontFamily:
'"Gochi Hand", "Comic Sans MS", "Bradley Hand", cursive',
- fontSize: { xs: "2.3rem", sm: "2.5rem" },
+ fontSize: { xs: "2rem", sm: "2.5rem" },
color: "#2f6df7",
background: "none",
border: "none",
@@ -449,7 +547,10 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
cursor: "pointer",
textDecoration: "underline",
textUnderlineOffset: "3px",
- transform: { xs: "translateY(60px) rotate(-3deg)", sm: "translateY(68px) rotate(-4deg)" },
+ transform: {
+ xs: "translateX(20px) rotate(-3deg)",
+ sm: "translateY(68px) rotate(-4deg)",
+ },
"&:hover": {
color: "#5d92ff",
textDecoration: "underline",
@@ -461,11 +562,14 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
</Typography>
<Box
sx={{
- transform: { xs: "translateY(86px) rotate(3deg)", sm: "translateY(94px) rotate(4deg)" },
+ transform: {
+ xs: "rotate(3deg)",
+ sm: "translateY(94px) rotate(4deg)",
+ },
display: "flex",
flexDirection: "column",
alignItems: "center",
- minWidth: 84,
+ minWidth: { xs: 72, sm: 84 },
}}
>
<Typography
@@ -474,7 +578,7 @@ export const PasteLinkCard = ({ link, onCopy, onShare }: PasteLinkCardProps) =>
sx={{
fontFamily:
'"Gochi Hand", "Comic Sans MS", "Bradley Hand", cursive',
- fontSize: { xs: "2.3rem", sm: "2.5rem" },
+ fontSize: { xs: "2rem", sm: "2.5rem" },
color: "#2f6df7",
background: "none",
border: "none",
diff --git a/web/apps/paste/src/pages/_app.tsx b/web/apps/paste/src/pages/_app.tsx
index 6483e818c5..06a102a762 100644
--- a/web/apps/paste/src/pages/_app.tsx
+++ b/web/apps/paste/src/pages/_app.tsx
@@ -18,6 +18,15 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
>
<CustomHead title="Ente Paste" />
<CssBaseline enableColorScheme />
+ <style jsx global>{`
+ html,
+ body,
+ #__next {
+ width: 100%;
+ max-width: 100%;
+ overflow-x: hidden;
+ }
+ `}</style>
<Component {...pageProps} />
</ThemeProvider>
);
diff --git a/web/apps/paste/src/pages/index.tsx b/web/apps/paste/src/pages/index.tsx
index 1a3927c67b..a231892b78 100644
--- a/web/apps/paste/src/pages/index.tsx
+++ b/web/apps/paste/src/pages/index.tsx
@@ -54,6 +54,7 @@ const Page = () => {
sx={{
width: "100%",
maxWidth: { xs: "100%", md: 620 },
+ minWidth: 0,
mx: "auto",
}}
>