make the Dress to Impress text clickable

oops, right, it was not part of the link! Now it is. Feels much better :)
This commit is contained in:
Emi Matchu 2020-09-21 03:18:32 -07:00
parent 1eeba40fac
commit a81060d5b8

View file

@ -10,20 +10,9 @@ import HomeLinkIcon from "../images/home-link-icon.png";
import HomeLinkIcon2x from "../images/home-link-icon@2x.png"; import HomeLinkIcon2x from "../images/home-link-icon@2x.png";
function GlobalHeader() { function GlobalHeader() {
const { pathname } = useLocation();
const isHomePage = pathname === "/";
return ( return (
<Box display="flex" alignItems="center" flexWrap="wrap"> <Box display="flex" alignItems="center" flexWrap="wrap">
<HomeLink showArrow={!isHomePage} marginRight="2" /> <HomeLink marginRight="2" />
<Box
display="flex"
alignItems="center"
opacity={isHomePage ? "0" : "1"}
transition="0.2s opacity"
>
<DressToImpressTitle />
</Box>
<Box marginLeft="auto"> <Box marginLeft="auto">
<UserNavBarSection /> <UserNavBarSection />
</Box> </Box>
@ -31,51 +20,73 @@ function GlobalHeader() {
); );
} }
function HomeLink({ showArrow, ...props }) { function HomeLink(props) {
const { pathname } = useLocation();
const isHomePage = pathname === "/";
return ( return (
<Box <Box
as={Link} as={Link}
to="/" to="/"
display="flex" display="flex"
alignItems="center" alignItems="center"
position="relative"
role="group" role="group"
transition="all 0.2s"
opacity="0.8"
_hover={{ transform: "scale(1.1)", opacity: "1" }}
_focus={{ transform: "scale(1.1)", opacity: "1" }}
{...props} {...props}
> >
<Box <Box
position="absolute" display="flex"
right="100%" alignItems="center"
opacity={showArrow ? "1" : "0"} marginRight="2"
transform={showArrow ? "none" : "translateX(3px)"} position="relative"
transition="all 0.2s" transition="all 0.2s"
opacity="0.8"
_groupHover={{ transform: "scale(1.1)", opacity: "1" }}
_groupFocus={{ transform: "scale(1.1)", opacity: "1" }}
> >
<ChevronLeftIcon /> <Box
position="absolute"
right="100%"
opacity={isHomePage ? "0" : "1"}
transform={isHomePage ? "translateX(3px)" : "none"}
transition="all 0.2s"
>
<ChevronLeftIcon />
</Box>
<Box
as="img"
src={HomeLinkIcon}
srcSet={`${HomeLinkIcon} 1x, ${HomeLinkIcon2x} 2x`}
alt=""
height="2em"
width="2em"
borderRadius="lg"
boxShadow="md"
/>
<Box
height="2em"
width="2em"
position="absolute"
top="0"
left="0"
right="0"
bottom="0"
borderRadius="lg"
transition="border 0.2s"
/>
</Box> </Box>
<Box <Box
as="img" fontFamily="Delicious"
src={HomeLinkIcon} fontWeight="600"
srcSet={`${HomeLinkIcon} 1x, ${HomeLinkIcon2x} 2x`} fontSize="2xl"
alt="" display={{ base: "none", sm: "block" }}
height="2em" opacity={isHomePage ? "0" : "1"}
width="2em" transition="all 0.2s"
borderRadius="lg" marginRight="2"
boxShadow="md" _groupHover={{ fontWeight: "900" }}
/> _groupFocus={{ fontWeight: "900" }}
<Box >
height="2em" Dress to Impress
width="2em" </Box>
position="absolute"
top="0"
left="0"
right="0"
bottom="0"
borderRadius="lg"
transition="border 0.2s"
/>
</Box> </Box>
); );
} }
@ -121,20 +132,6 @@ function UserNavBarSection() {
} }
} }
function DressToImpressTitle(props) {
return (
<Box
fontFamily="Delicious"
fontWeight="bold"
fontSize="2xl"
display={{ base: "none", sm: "block" }}
{...props}
>
Dress to Impress
</Box>
);
}
const NavButton = React.forwardRef(({ icon, ...props }, ref) => { const NavButton = React.forwardRef(({ icon, ...props }, ref) => {
const Component = icon ? IconButton : Button; const Component = icon ? IconButton : Button;