codenawis-theme
Version:
A frontity theme by @mymakarim @codenawis
53 lines (46 loc) • 1.13 kB
JavaScript
import React from "react";
import { styled, connect } from "frontity";
import Link from "./link";
const MenuModal = ({ state }) => {
const { menu } = state.theme;
const isThereLinks = menu != null && menu.length > 0;
return (
<>
<MenuContent as="nav">
{isThereLinks &&
menu.map(([name, link]) => (
<MenuLink
key={name}
link={link}
aria-current={state.router.link === link ? "page" : undefined}
>
{name}
</MenuLink>
))}
</MenuContent>
</>
);
};
const MenuContent = styled.div`
z-index: 3;
`;
const MenuLink = styled(Link)`
width: 100%;
display: inline-block;
outline: 0;
font-size: 20px;
text-align: center;
padding: 1.2rem 0;
color: white !important;
&:hover,
&:focus {
background-color: rgba(0, 0, 0, 0.05);
}
/* styles for active link */
&[aria-current="page"] {
color: yellow;
font-weight: bold;
/* border-bottom: 4px solid yellow; */
}
`;
export default connect(MenuModal);