Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | import { styled, Typography } from "@mui/material"; import StyledLink from "components/StyledLink"; import { DASHBOARD } from "i18n/namespaces"; import { useTranslation } from "next-i18next"; import { routeToEditProfile } from "routes"; import { theme } from "theme"; const StyledLinksContainer = styled("div")(() => ({ display: "flex", flexWrap: "wrap", rowGap: theme.spacing(2), columnGap: theme.spacing(4), justifyContent: "center", margin: theme.spacing(4, 0), })); const makeStyledTab = <C extends React.ComponentType<React.ComponentProps<C>>>( component: C, ) => { return styled(component, { shouldForwardProp: (prop) => prop !== "isSelected", })<{ isSelected?: boolean }>((props) => ({ position: "relative", paddingBottom: theme.spacing(1), color: theme.palette.common.white, "&::after": { content: '""', position: "absolute", bottom: 0, left: "50%", transform: "translateX(-50%)", width: 40, height: 2, background: theme.palette.common.white, transition: `opacity ${theme.transitions.duration.short}ms ${theme.transitions.easing.easeInOut}`, opacity: props.isSelected ? 1 : 0, }, "&:hover::after": { opacity: 1, }, })); }; const StyledDefaultTab = makeStyledTab(Typography); const StyledLinkTab = makeStyledTab(StyledLink); export default function HeroLinks() { const { t } = useTranslation(DASHBOARD); return ( <> <StyledLinksContainer> <StyledDefaultTab color="textPrimary" variant="body1" isSelected={true}> {t("find_a_host")} </StyledDefaultTab> <StyledLinkTab underline="none" href={routeToEditProfile("home")}> {t("become_a_host")} </StyledLinkTab> <StyledLinkTab underline="none" href="/communities"> {t("browse_communities")} </StyledLinkTab> </StyledLinksContainer> </> ); } |