Skip to content

Commit

Permalink
editing button to change the text and url depend on the size of the s…
Browse files Browse the repository at this point in the history
…creen
  • Loading branch information
TalBenAvi committed May 7, 2024
1 parent f58c195 commit cedd055
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions workspaces/website/src/blocks/HomepageHero.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Box, Flex, Img, Stack } from "@chakra-ui/react";
import {
Box,
Flex,
Img,
Stack,
useTheme,
useMediaQuery,
} from "@chakra-ui/react";
import { Button } from "@ui/Button";
import { Heading } from "@ui/Typography/Heading";
import { Text } from "@ui/Typography/Text";
Expand All @@ -12,6 +19,14 @@ type Props = {
};

export const HomepageHero = ({ seo }: Props) => {
const theme = useTheme();
const breakpoints = theme.breakpoints;
const { md } = breakpoints;
const [isLargerThanSm] = useMediaQuery(`(min-width: ${md})`, {
ssr: true,
fallback: false,
});

return (
<>
<ProvisionsPopup />
Expand Down Expand Up @@ -129,10 +144,14 @@ export const HomepageHero = ({ seo }: Props) => {
<Button
size="lg"
variant="secondaryHero"
href="https://starkgate.starknet.io/"
target="_blank"
href={
isLargerThanSm
? "https://starkgate.starknet.io/"
: "/en/what-is-starknet"
}
target={isLargerThanSm ? "_blank" : ""}
>
Bridge
{isLargerThanSm ? "Bridge" : "Explore Starknet"}
</Button>
</Stack>
</Box>
Expand Down

0 comments on commit cedd055

Please sign in to comment.