Skip to content

Commit a52d215

Browse files
committed
fix: use hideFrom to prevent layout shifts
For MobileButton component, removing usage of Hide/Show
1 parent c855eab commit a52d215

File tree

6 files changed

+17
-31
lines changed

6 files changed

+17
-31
lines changed

src/components/MdComponents.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ export const MobileButton = (props: ChildOnlyProp) => {
234234
const borderColor = useToken("colors", "border")
235235
return (
236236
<Box
237+
hideFrom="lg"
237238
bg="background.base"
238239
boxShadow={`0 -1px 0 ${borderColor}`}
239240
position="sticky"

src/layouts/Roadmap.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
Box,
33
Center,
44
Flex,
5-
Show,
65
SimpleGrid,
76
useToken,
87
Wrap,
@@ -199,11 +198,9 @@ export const RoadmapLayout: React.FC<IProps> = ({
199198
{children}
200199
<FeedbackCard />
201200
</ContentContainer>
202-
<Show below="lg">
203-
<MobileButton>
204-
<MobileButtonDropdown list={dropdownLinks} />
205-
</MobileButton>
206-
</Show>
201+
<MobileButton>
202+
<MobileButtonDropdown list={dropdownLinks} />
203+
</MobileButton>
207204
</Page>
208205
</Box>
209206
)

src/layouts/Staking.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Flex,
77
Grid,
88
type HeadingProps,
9-
Show,
109
SimpleGrid,
1110
Text,
1211
UnorderedList,
@@ -292,12 +291,9 @@ export const StakingLayout: React.FC<IProps> = ({
292291
<StakingCommunityCallout my={16} />
293292
<FeedbackCard />
294293
</ContentContainer>
295-
{/* // TODO: Switch to `above="lg"` after completion of Chakra Migration */}
296-
<Show below={lgBp}>
297-
<MobileButton>
298-
<MobileButtonDropdown list={dropdownLinks} />
299-
</MobileButton>
300-
</Show>
294+
<MobileButton>
295+
<MobileButtonDropdown list={dropdownLinks} />
296+
</MobileButton>
301297
</Page>
302298
</Box>
303299
)

src/layouts/Upgrade.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,9 @@ export const UpgradeLayout: React.FC<IProps> = ({
222222
{children}
223223
<FeedbackCard />
224224
</ContentContainer>
225-
<Show below={lgBreakpoint}>
226-
<MobileButton>
227-
<MobileButtonDropdown list={dropdownLinks} />
228-
</MobileButton>
229-
</Show>
225+
<MobileButton>
226+
<MobileButtonDropdown list={dropdownLinks} />
227+
</MobileButton>
230228
</Page>
231229
</Container>
232230
)

src/layouts/UseCases.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { MdExpandMore } from "react-icons/md"
44
import {
55
Box,
66
Flex,
7-
Hide,
87
Icon,
98
ListItem,
109
Text,
@@ -256,11 +255,9 @@ export const UseCasesLayout: React.FC<IProps> = ({
256255
{children}
257256
<FeedbackCard />
258257
</ContentContainer>
259-
<Hide above={lgBp}>
260-
<MobileButton>
261-
<MobileButtonDropdown list={dropdownLinks} />
262-
</MobileButton>
263-
</Hide>
258+
<MobileButton>
259+
<MobileButtonDropdown list={dropdownLinks} />
260+
</MobileButton>
264261
</Page>
265262
</Box>
266263
)

src/pages/staking/index.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ReactNode } from "react"
22
import { GetStaticProps, InferGetStaticPropsType } from "next"
33
import { useTranslation } from "next-i18next"
44
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
5-
import { Box, Flex, Grid, HeadingProps, Show, useToken } from "@chakra-ui/react"
5+
import { Box, Flex, Grid, HeadingProps, useToken } from "@chakra-ui/react"
66

77
import type {
88
BasePageProps,
@@ -742,12 +742,9 @@ const StakingPage = ({
742742
</Box>
743743
</Flex>
744744
</ContentContainer>
745-
{/* // TODO: Switch to `above="lg"` after completion of Chakra Migration */}
746-
<Show below={lgBp}>
747-
<MobileButton>
748-
<MobileButtonDropdown list={dropdownLinks} />
749-
</MobileButton>
750-
</Show>
745+
<MobileButton>
746+
<MobileButtonDropdown list={dropdownLinks} />
747+
</MobileButton>
751748
</Page>
752749
</PageContainer>
753750
)

0 commit comments

Comments
 (0)