Skip to content

Commit cedd055

Browse files
committed
editing button to change the text and url depend on the size of the screen
1 parent f58c195 commit cedd055

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

workspaces/website/src/blocks/HomepageHero.tsx

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { Box, Flex, Img, Stack } from "@chakra-ui/react";
1+
import {
2+
Box,
3+
Flex,
4+
Img,
5+
Stack,
6+
useTheme,
7+
useMediaQuery,
8+
} from "@chakra-ui/react";
29
import { Button } from "@ui/Button";
310
import { Heading } from "@ui/Typography/Heading";
411
import { Text } from "@ui/Typography/Text";
@@ -12,6 +19,14 @@ type Props = {
1219
};
1320

1421
export const HomepageHero = ({ seo }: Props) => {
22+
const theme = useTheme();
23+
const breakpoints = theme.breakpoints;
24+
const { md } = breakpoints;
25+
const [isLargerThanSm] = useMediaQuery(`(min-width: ${md})`, {
26+
ssr: true,
27+
fallback: false,
28+
});
29+
1530
return (
1631
<>
1732
<ProvisionsPopup />
@@ -129,10 +144,14 @@ export const HomepageHero = ({ seo }: Props) => {
129144
<Button
130145
size="lg"
131146
variant="secondaryHero"
132-
href="https://starkgate.starknet.io/"
133-
target="_blank"
147+
href={
148+
isLargerThanSm
149+
? "https://starkgate.starknet.io/"
150+
: "/en/what-is-starknet"
151+
}
152+
target={isLargerThanSm ? "_blank" : ""}
134153
>
135-
Bridge
154+
{isLargerThanSm ? "Bridge" : "Explore Starknet"}
136155
</Button>
137156
</Stack>
138157
</Box>

0 commit comments

Comments
 (0)