ISSUE-008 - Significantly improved the look of the main page menu.
This commit is contained in:
1 parent
71a92a20e7
commit
73ba3b4ddd
10 files changed
+113
-61
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { FC, Children } from "react";
|
||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||
|
||||
import { MenuBar, MenuItem } from "./styles";
|
||||
|
||||
import f1Logo from "../../public/images/logos/f1-logo-red.svg";
|
||||
|
||||
type MenuProps = {
|
||||
title: string,
|
||||
};
|
||||
export const Menu: FC<MenuProps> = ({
|
||||
title,
|
||||
children,
|
||||
}) => {
|
||||
const childrenArray = Children.toArray(children);
|
||||
return (
|
||||
<MenuBar>
|
||||
<img src={f1Logo} alt="Formula One logo" height="20px"/>
|
||||
<h3>{title}</h3>
|
||||
<nav>
|
||||
<InlineCluster as="ul" gutter="sm" justify="end">
|
||||
{childrenArray.map((child, i) => (
|
||||
<MenuItem key={i}>{child}</MenuItem>
|
||||
))}
|
||||
</InlineCluster>
|
||||
</nav>
|
||||
</MenuBar>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./Menu";
|
||||
@@ -0,0 +1,35 @@
|
||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||
import { PadBox } from "@bedrock-layout/padbox";
|
||||
import styled from "styled-components";
|
||||
|
||||
export const MenuBar = styled(InlineCluster).attrs(() => ({
|
||||
as: PadBox,
|
||||
padding: ["xs", "lg"],
|
||||
stretch: 1,
|
||||
gutter: "lg",
|
||||
align: "center",
|
||||
}))`
|
||||
background-image: linear-gradient(to right, #f0f0f0, #fff);
|
||||
border-block-end: 1px solid #303030;
|
||||
`;
|
||||
|
||||
type MenuItemProps = {
|
||||
active?: boolean,
|
||||
};
|
||||
export const MenuItem = styled(PadBox).attrs(() => ({
|
||||
as: "li",
|
||||
padding: ["sm", "lg"],
|
||||
})) <MenuItemProps>`
|
||||
border-radius: 0.25rem;
|
||||
> a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
font-weight: 900;
|
||||
}
|
||||
:hover {
|
||||
background: #303030;
|
||||
> a {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
`;
|
||||
Reference in new issue
Block a user