feat: optimize mobile responsive layout for share page

- Add responsive design for mobile devices (≤768px)
- Switch from horizontal to vertical layout on mobile
- Hide middle divider panel on mobile
- Optimize button sizes for mobile touch interaction
- Improve input field and button alignment on mobile
This commit is contained in:
loveuer
2026-01-18 17:12:07 +08:00
parent 8a063d15d9
commit d38fa7a507
4 changed files with 126 additions and 25 deletions

View File

@@ -11,6 +11,12 @@ const useUploadStyle = createUseStyles({
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
minHeight: "50vh",
"@media (max-width: 768px)": {
minHeight: "auto",
padding: "20px 10px",
},
}, },
form: { form: {
backgroundColor: "#C8E6C9", backgroundColor: "#C8E6C9",
@@ -19,10 +25,20 @@ const useUploadStyle = createUseStyles({
borderRadius: "15px", borderRadius: "15px",
width: "70%", width: "70%",
margin: "20px 60px 20px 0", margin: "20px 60px 20px 0",
/*todo margin 不用 px*/
"@media (max-width: 768px)": {
width: "90%",
margin: "20px 0",
padding: "20px",
},
}, },
title: { title: {
color: "#2c9678" color: "#2c9678",
"@media (max-width: 768px)": {
fontSize: "1.5rem",
marginBottom: "15px",
},
}, },
file: { file: {
display: 'none', display: 'none',
@@ -33,7 +49,11 @@ const useUploadStyle = createUseStyles({
}, },
name: { name: {
color: "#2c9678", color: "#2c9678",
marginLeft: '10px' marginLeft: '10px',
"@media (max-width: 768px)": {
fontSize: "14px",
},
}, },
clean: { clean: {
borderRadius: '50%', borderRadius: '50%',
@@ -48,14 +68,12 @@ const useShowStyle = createUseStyles({
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
position: "relative", // 为关闭按钮提供定位基准 minHeight: "50vh",
"@media (max-width: 768px)": {
minHeight: "auto",
padding: "20px 10px",
}, },
title: {
color: "#2c9678",
marginTop: 0,
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}, },
form: { form: {
backgroundColor: "#C8E6C9", backgroundColor: "#C8E6C9",
@@ -65,6 +83,25 @@ const useShowStyle = createUseStyles({
width: "70%", width: "70%",
margin: "20px 60px 20px 0", margin: "20px 60px 20px 0",
position: "relative", position: "relative",
"@media (max-width: 768px)": {
width: "90%",
margin: "20px 0",
padding: "20px",
},
},
title: {
color: "#2c9678",
marginTop: 0,
marginBottom: "25px",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
"@media (max-width: 768px)": {
fontSize: "1.5rem",
marginBottom: "15px",
},
}, },
closeButton: { closeButton: {
position: "absolute", position: "absolute",
@@ -78,9 +115,7 @@ const useShowStyle = createUseStyles({
height: "24px", height: "24px",
cursor: "pointer", cursor: "pointer",
"&:hover": { "&:hover": {
// background: "#cc0000",
boxShadow: "20px 20px 60px #fff, -20px -20px 60px #fff", boxShadow: "20px 20px 60px #fff, -20px -20px 60px #fff",
// boxShadow: "20px 20px 60px #eee",
}, },
}, },
codeWrapper: { codeWrapper: {
@@ -89,6 +124,10 @@ const useShowStyle = createUseStyles({
borderRadius: "8px", borderRadius: "8px",
margin: "15px 0", margin: "15px 0",
overflowX: "auto", overflowX: "auto",
"@media (max-width: 768px)": {
padding: "0 10px",
},
}, },
pre: { pre: {
display: 'flex', display: 'flex',
@@ -98,6 +137,12 @@ const useShowStyle = createUseStyles({
height: '24px', height: '24px',
"& > code": { "& > code": {
marginLeft: "0", marginLeft: "0",
fontSize: "14px",
wordBreak: "break-all",
"@media (max-width: 768px)": {
fontSize: "12px",
},
} }
}, },
copyButton: { copyButton: {
@@ -112,6 +157,11 @@ const useShowStyle = createUseStyles({
"&:hover": { "&:hover": {
background: "#1f6d5a", background: "#1f6d5a",
}, },
"@media (max-width: 768px)": {
padding: "6px 12px",
fontSize: "12px",
},
}, },
}); });

View File

@@ -5,6 +5,10 @@ const useStyle = createUseStyles({
backgroundColor: 'lightgray', backgroundColor: 'lightgray',
position: "relative", position: "relative",
overflow: "hidden", overflow: "hidden",
"@media (max-width: 768px)": {
display: "none",
},
}, },
left: { left: {
backgroundColor: "#e3f2fd", backgroundColor: "#e3f2fd",

View File

@@ -8,6 +8,12 @@ const useStyle = createUseStyles({
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
alignItems: "center", alignItems: "center",
minHeight: "50vh",
"@media (max-width: 768px)": {
minHeight: "auto",
padding: "20px 10px",
},
}, },
form: { form: {
backgroundColor: "#BBDEFB", backgroundColor: "#BBDEFB",
@@ -16,21 +22,54 @@ const useStyle = createUseStyles({
borderRadius: "15px", borderRadius: "15px",
width: "70%", width: "70%",
margin: "20px 0 20px 60px", margin: "20px 0 20px 60px",
/*todo margin 不用 px*/
"@media (max-width: 768px)": {
width: "90%",
margin: "20px 0",
padding: "20px",
},
}, },
title: { title: {
color: '#1661ab', // 靛青 color: '#1661ab',
"@media (max-width: 768px)": {
fontSize: "1.5rem",
marginBottom: "15px",
},
}, },
code: { code: {
padding: '11px', padding: '11px',
margin: '20px 0', margin: '0',
width: '200px', width: '200px',
border: '2px solid #ddd', border: '2px solid #ddd',
borderRadius: '5px', borderRadius: '5px',
'&:active': { '&:active': {
border: '2px solid #1661ab', border: '2px solid #1661ab',
} },
}
"@media (max-width: 768px)": {
width: '100%',
boxSizing: 'border-box',
padding: '10px',
fontSize: '14px',
},
},
inputContainer: {
display: 'flex',
gap: '10px',
"@media (max-width: 768px)": {
flexDirection: 'column',
alignItems: 'stretch',
},
},
buttonContainer: {
display: 'flex',
"@media (max-width: 768px)": {
justifyContent: 'left',
},
},
}) })
export const PanelRight = () => { export const PanelRight = () => {
const style = useStyle() const style = useStyle()
@@ -52,7 +91,7 @@ export const PanelRight = () => {
return <div className={style.container}> return <div className={style.container}>
<div className={style.form}> <div className={style.form}>
<h2 className={style.title}></h2> <h2 className={style.title}></h2>
<div> <div className={style.inputContainer}>
<input <input
type="text" type="text"
className={style.code} className={style.code}
@@ -60,7 +99,9 @@ export const PanelRight = () => {
value={code} value={code}
onChange={onCodeChange} onChange={onCodeChange}
/> />
<UButton style={{marginLeft: '10px'}} onClick={onFetchFile}></UButton> <div className={style.buttonContainer}>
<UButton onClick={onFetchFile}></UButton>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -13,6 +13,12 @@ const useStyle = createUseStyles({
height: "100vh", height: "100vh",
display: "grid", display: "grid",
gridTemplateColumns: "40% 20% 40%", gridTemplateColumns: "40% 20% 40%",
"@media (max-width: 768px)": {
gridTemplateColumns: "100%",
gridTemplateRows: "auto auto",
overflowY: "auto",
},
}, },
}) })