Menu component update
This commit is contained in:
1 parent
feb59b8b8e
commit
ddd6c9daa3
1 file changed
+92
-93
@@ -10,117 +10,116 @@ export interface IMenuProps {
|
|||||||
items: any[]
|
items: any[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Menu: React.FC<IMenuProps> = props => {
|
export const Menu: React.FC<IMenuProps> = props => (
|
||||||
return (
|
<div className={cx('menu', props.layout)}>
|
||||||
<div className={cx(props.layout)}>
|
<style jsx>{`
|
||||||
<style jsx>{`
|
.menu {
|
||||||
div {
|
display: flex;
|
||||||
display: flex;
|
align-items: flex-start;
|
||||||
align-items: flex-start;
|
|
||||||
|
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.desktop {
|
div.desktop {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
div.mobile {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
li{
|
|
||||||
position: relative;
|
|
||||||
border-top: var(--menu-colored-mark-thickness) solid rgba(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
li.desktop {
|
div.mobile {
|
||||||
padding: 0.3em 0.2em 0;
|
flex-direction: column;
|
||||||
margin-left: 1em;
|
}
|
||||||
margin-right: 1em;
|
|
||||||
|
li{
|
||||||
|
position: relative;
|
||||||
|
border-top: var(--menu-colored-mark-thickness) solid rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
font-size: var(--normal-font-size);
|
li.desktop {
|
||||||
}
|
padding: 0.3em 0.2em 0;
|
||||||
|
margin-right: 1em;
|
||||||
|
|
||||||
li.mobile {
|
font-size: var(--normal-font-size);
|
||||||
padding: 0.3em 0.5em;
|
}
|
||||||
margin-bottom: var(--half-margin);
|
|
||||||
|
|
||||||
font-size: 1.25em;
|
li.mobile {
|
||||||
}
|
padding: 0.3em 0.5em;
|
||||||
|
margin-bottom: var(--half-margin);
|
||||||
|
|
||||||
li:last-child {
|
font-size: 1.25em;
|
||||||
margin-right: 0;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.selected {
|
li:last-child {
|
||||||
font-weight: bold;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.desktop.selected.blue {
|
li.selected {
|
||||||
border-top-color: var(--blue-color);
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.desktop.selected.orange {
|
li.desktop.selected.blue {
|
||||||
border-top-color: var(--orange-color);
|
border-top-color: var(--blue-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.desktop.selected.green {
|
li.desktop.selected.orange {
|
||||||
border-top-color: var(--green-color);
|
border-top-color: var(--orange-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.desktop.selected.yellow {
|
li.desktop.selected.green {
|
||||||
border-top-color: var(--yellow-color);
|
border-top-color: var(--green-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.desktop.selected.pink {
|
li.desktop.selected.yellow {
|
||||||
border-top-color: var(--pink-color);
|
border-top-color: var(--yellow-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.desktop.selected.red {
|
li.desktop.selected.pink {
|
||||||
border-top-color: var(--red-color);
|
border-top-color: var(--pink-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.mobile.selected.blue {
|
li.desktop.selected.red {
|
||||||
background-color: var(--blue-color);
|
border-top-color: var(--red-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.mobile.selected.orange {
|
li.mobile.selected.blue {
|
||||||
background-color: var(--orange-color);
|
background-color: var(--blue-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.mobile.selected.green {
|
li.mobile.selected.orange {
|
||||||
background-color: var(--green-color);
|
background-color: var(--orange-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.mobile.selected.yellow {
|
li.mobile.selected.green {
|
||||||
background-color: var(--yellow-color);
|
background-color: var(--green-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.mobile.selected.pink {
|
li.mobile.selected.yellow {
|
||||||
background-color: var(--pink-color);
|
background-color: var(--yellow-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
li.mobile.selected.red {
|
li.mobile.selected.pink {
|
||||||
background-color: var(--red-color);
|
background-color: var(--pink-color);
|
||||||
}
|
}
|
||||||
`}</style>
|
|
||||||
|
|
||||||
{props.items.map((item, index) => (
|
li.mobile.selected.red {
|
||||||
<li key={index}
|
background-color: var(--red-color);
|
||||||
className={cx(
|
}
|
||||||
props.layout,
|
`}</style>
|
||||||
item.color, {
|
|
||||||
selected: item.highlighted,
|
{props.items.map((item, index) => (
|
||||||
})}
|
<li key={index}
|
||||||
>
|
className={cx(
|
||||||
<MenuItem
|
props.layout,
|
||||||
url={itemUrl(item.url)}
|
item.color, {
|
||||||
text={item.text}
|
selected: item.highlighted,
|
||||||
active={item.active}
|
})}
|
||||||
/>
|
>
|
||||||
</li>
|
<MenuItem
|
||||||
))}
|
url={itemUrl(item.url)}
|
||||||
</div>
|
text={item.text}
|
||||||
)
|
active={item.active}
|
||||||
}
|
/>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
Reference in new issue
Block a user