Skip to content

Commit 3284cd9

Browse files
committed
Refactor responsive styles in CredentialTracker, NavBar, and Form components to improve layout on smaller screens
1 parent f68e02c commit 3284cd9

3 files changed

Lines changed: 33 additions & 19 deletions

File tree

app/components/credetialTracker/Page.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const generateVideoThumbnail = (videoUrl: string): Promise<string> => {
8686
const HeaderContainer = styled(Paper)(({ theme }) => ({
8787
width: '100%',
8888
maxWidth: '720px',
89-
padding: '30px',
89+
padding: theme.breakpoints.down('sm') ? '18px' : '30px',
9090
borderRadius: '20px 20px 0 0',
9191
borderLeft: '1px solid #d1e4ff',
9292
borderRight: '1px solid #d1e4ff',
@@ -98,7 +98,7 @@ const HeaderContainer = styled(Paper)(({ theme }) => ({
9898
const MainContentContainer = styled(Box)(({ theme }) => ({
9999
width: '100%',
100100
maxWidth: '720px',
101-
padding: '45px 30px',
101+
padding: theme.breakpoints.down('sm') ? '24px 8px' : '45px 30px',
102102
backgroundColor: '#87abe4',
103103
borderRadius: '0 0 20px 20px',
104104
borderTop: '1px solid #d1e4ff',
@@ -108,7 +108,7 @@ const MainContentContainer = styled(Box)(({ theme }) => ({
108108
}))
109109

110110
const SkillCard = styled(Card)(({ theme }) => ({
111-
padding: '15px 30px',
111+
padding: theme.breakpoints.down('sm') ? '10px 8px' : '15px 30px',
112112
backgroundColor: '#fff',
113113
borderRadius: '10px',
114114
border: '1px solid #003fe0',
@@ -117,7 +117,7 @@ const SkillCard = styled(Card)(({ theme }) => ({
117117

118118
const FieldLabel = styled(Typography)(({ theme }) => ({
119119
fontFamily: 'Inter',
120-
fontSize: '16px',
120+
fontSize: theme.breakpoints.down('sm') ? '14px' : '16px',
121121
fontWeight: 700,
122122
lineHeight: '24px',
123123
color: '#000e40',
@@ -126,7 +126,7 @@ const FieldLabel = styled(Typography)(({ theme }) => ({
126126

127127
const FieldValue = styled(Typography)(({ theme }) => ({
128128
fontFamily: 'Inter',
129-
fontSize: '16px',
129+
fontSize: theme.breakpoints.down('sm') ? '14px' : '16px',
130130
fontWeight: 400,
131131
lineHeight: '24px',
132132
color: '#6b7280',
@@ -137,17 +137,17 @@ const FieldValue = styled(Typography)(({ theme }) => ({
137137
}))
138138

139139
const MediaContainer = styled(Box)(({ theme }) => ({
140-
height: '180px',
140+
height: theme.breakpoints.down('sm') ? '120px' : '180px',
141141
width: '100%',
142142
display: 'flex',
143143
justifyContent: 'center',
144144
alignItems: 'center',
145145
flexDirection: 'column'
146146
}))
147147

148-
const Media = styled(Box)<{ hasImage?: boolean }>(({ hasImage }) => ({
149-
width: '160.506px',
150-
height: '153.129px',
148+
const Media = styled(Box)<{ hasImage?: boolean }>(({ hasImage, theme }) => ({
149+
width: theme.breakpoints.down('sm') ? '100px' : '160.506px',
150+
height: theme.breakpoints.down('sm') ? '90px' : '153.129px',
151151
position: 'relative',
152152
backgroundImage: hasImage ? 'none' : 'url(/images/SkillMedia.svg)',
153153
backgroundSize: '100% 100%',
@@ -233,13 +233,14 @@ const CredentialTracker: React.FC<CredentialTrackerProps> = ({
233233
const featuredFile = selectedFiles.find(f => f.isFeatured)
234234

235235
return (
236-
<Box sx={{ p: 0, width: '100%', maxWidth: '720px' }}>
236+
<Box sx={{ p: 0, width: '100%', maxWidth: { xs: '100%', md: '720px' } }}>
237237
<Box
238238
sx={{
239239
display: 'flex',
240240
flexDirection: 'column',
241241
width: '100%',
242-
margin: '0 auto'
242+
margin: '0 auto',
243+
boxSizing: 'border-box'
243244
}}
244245
>
245246
{/* Header Section */}

app/components/navbar/NavBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const NavBar = () => {
3636
alignItems: 'center',
3737
backgroundColor: 'white',
3838
justifyContent: 'space-between',
39-
mt: { xs: '18px', md: '0px' },
39+
my: { xs: '18px', md: '0px' },
4040
boxShadow: {
4141
md: '0px 4px 10px rgba(209, 213, 219, 0.5)'
4242
}

app/credentialForm/form/Form.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,15 @@ const Form = ({ onStepChange }: any) => {
254254
return (
255255
<Box
256256
sx={{
257-
m: { xs: '50px auto', sm: '50px auto', md: '120px auto' },
257+
m: { xs: '24px auto', sm: '40px auto', md: '120px auto' },
258258
display: 'flex',
259-
gap: '90px',
260-
alignItems: 'flex-start',
261-
justifyContent: 'center'
259+
flexDirection: { xs: 'column', md: 'row' },
260+
gap: { xs: 3, md: '90px' },
261+
alignItems: { xs: 'stretch', md: 'flex-start' },
262+
justifyContent: 'center',
263+
width: '100%',
264+
maxWidth: { xs: '100%', md: '1500px' },
265+
px: { xs: 1, sm: 2, md: 0 }
262266
}}
263267
>
264268
<form
@@ -268,11 +272,12 @@ const Form = ({ onStepChange }: any) => {
268272
gap: '30px',
269273
alignItems: 'center',
270274
justifyItems: 'center',
271-
padding: ' 20px 20px 20px',
275+
padding: '20px 8px 20px',
272276
overflow: 'auto',
273277
width: '100%',
274278
maxWidth: '720px',
275-
backgroundColor: '#FFF'
279+
backgroundColor: '#FFF',
280+
boxSizing: 'border-box'
276281
}}
277282
onSubmit={handleFormSubmit}
278283
>
@@ -392,7 +397,15 @@ const Form = ({ onStepChange }: any) => {
392397
</form>
393398

394399
{activeStep >= 1 && activeStep <= 4 && (
395-
<CredentialTracker formData={watch()} selectedFiles={selectedFiles} />
400+
<Box
401+
sx={{
402+
width: { xs: '100%', md: '420px' },
403+
mt: { xs: 4, md: 0 },
404+
alignSelf: { xs: 'stretch', md: 'auto' }
405+
}}
406+
>
407+
<CredentialTracker formData={watch()} selectedFiles={selectedFiles} />
408+
</Box>
396409
)}
397410
</Box>
398411
)

0 commit comments

Comments
 (0)