Skip to content

Commit 0001f5f

Browse files
committed
fix: make the nav items responsive to avoid two-line layout on screen shrink
1 parent dd513cf commit 0001f5f

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

src/components/NavBar/NavItems.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ const NavItems: React.FC = () => {
8282
<Grid item xs={12} md="auto">
8383
<Grid
8484
container
85-
spacing={3}
85+
spacing={{ xs: 2, md: 5 }}
86+
direction={{ xs: "row", sm: "row" }} // row on mobile
8687
justifyContent="center"
87-
sx={{ mb: { xs: 1 } }}
88+
alignItems="center"
89+
sx={{
90+
mb: { xs: 1 },
91+
rowGap: { xs: 1, sm: 2 },
92+
}}
8893
>
8994
{[
9095
{ text: "About", url: RoutesEnum.ABOUT },
@@ -107,6 +112,10 @@ const NavItems: React.FC = () => {
107112
lineHeight={"1.5rem"}
108113
letterSpacing={"0.05rem"}
109114
sx={{
115+
fontSize: {
116+
xs: "0.8rem", // font size on mobile
117+
sm: "1rem",
118+
},
110119
color: Colors.white,
111120
transition: "color 0.3s ease, transform 0.3s ease",
112121
textTransform: "uppercase",
@@ -127,6 +136,10 @@ const NavItems: React.FC = () => {
127136
lineHeight={"1.5rem"}
128137
letterSpacing={"0.05rem"}
129138
sx={{
139+
fontSize: {
140+
xs: "0.8rem", // font size on mobile
141+
sm: "1rem",
142+
},
130143
color: Colors.white,
131144
transition: "color 0.3s ease, transform 0.3s ease",
132145
textTransform: "uppercase",

src/components/StatisticsBanner.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,17 @@ const StatisticsBanner: React.FC = () => {
8585
number: string;
8686
label: string;
8787
}) => (
88-
<Box sx={{ display: "flex", flexDirection: "row", alignItems: "center" }}>
88+
<Box
89+
sx={{
90+
display: "flex",
91+
flexDirection: "row",
92+
alignItems: "center",
93+
textAlign: {
94+
xs: "left",
95+
sm: "center",
96+
},
97+
}}
98+
>
8999
<Box sx={iconStyle}>{icon}</Box>
90100
<Box>
91101
<Typography sx={numberTextStyle}>{number}</Typography>
@@ -101,7 +111,10 @@ const StatisticsBanner: React.FC = () => {
101111
padding: "1rem",
102112
display: "flex",
103113
flexWrap: "wrap",
104-
justifyContent: "center",
114+
justifyContent: {
115+
xs: "flex-start",
116+
sm: "center",
117+
},
105118
gap: "2rem",
106119
}}
107120
>

0 commit comments

Comments
 (0)