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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 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";
const StyledLinksContainer = styled("div")(({ theme }) => ({
display: "flex",
flexWrap: "wrap",
rowGap: theme.spacing(2),
columnGap: theme.spacing(4),
justifyContent: "center",
marginBottom: theme.spacing(3),
[theme.breakpoints.down("sm")]: {
columnGap: theme.spacing(0.5),
rowGap: theme.spacing(0.5),
marginBottom: theme.spacing(2),
},
}));
const makeStyledTab = <C extends React.ComponentType<React.ComponentProps<C>>>(
component: C,
) => {
return styled(component, {
shouldForwardProp: (prop) => prop !== "isSelected",
})<{ isSelected?: boolean }>(({ theme, isSelected }) => ({
position: "relative",
paddingBottom: theme.spacing(1),
color: "var(--mui-palette-text-primary)",
fontWeight: 600,
"&::after": {
content: '""',
position: "absolute",
bottom: 0,
left: "50%",
transform: "translateX(-50%)",
width: 40,
height: 2,
background: "var(--mui-palette-primary-main)",
transition: `opacity ${theme.transitions.duration.short}ms ${theme.transitions.easing.easeInOut}`,
opacity: isSelected ? 1 : 0,
},
"&:hover::after": {
opacity: 1,
},
// Mobile pill style
[theme.breakpoints.down("sm")]: {
fontSize: "0.7rem",
fontWeight: 500,
padding: theme.spacing(0.5, 1),
paddingBottom: theme.spacing(0.5),
borderRadius: "9999px",
backgroundColor: isSelected
? "var(--mui-palette-primary-main)"
: "var(--mui-palette-grey-200)",
color: isSelected
? "var(--mui-palette-primary-contrastText)"
: "var(--mui-palette-text-primary)",
whiteSpace: "nowrap",
"&::after": {
display: "none",
},
"&:hover": {
backgroundColor: isSelected
? "var(--mui-palette-primary-main)"
: "var(--mui-palette-grey-300)",
},
},
}));
};
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>
</>
);
}
|