🚧 add navigation elements to the dropdown menu
This commit is contained in:
parent
91a766dd45
commit
c58cdc29c3
2 changed files with 61 additions and 34 deletions
|
@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { remSize, prop, common } from '../theme';
|
import { remSize, prop, common } from '../theme';
|
||||||
|
import IconButton from './mobile/IconButton';
|
||||||
|
import Button from '../common/Button';
|
||||||
|
|
||||||
|
|
||||||
// <ul className="nav__dropdown">
|
// <ul className="nav__dropdown">
|
||||||
|
@ -51,21 +53,21 @@ import { remSize, prop, common } from '../theme';
|
||||||
// color: getThemifyVariable('primary-text-color');
|
// color: getThemifyVariable('primary-text-color');
|
||||||
// }
|
// }
|
||||||
// text-align: left;
|
// text-align: left;
|
||||||
// width: #{180 / $base-font-size}rem;
|
// width: ${remSize(180)};
|
||||||
// display: flex;
|
// display: flex;
|
||||||
// position: absolute;
|
// position: absolute;
|
||||||
// flex-direction: column;
|
// flex-direction: column;
|
||||||
// top: 95%;
|
// top: 95%;
|
||||||
// height: auto;
|
// height: auto;
|
||||||
// z-index: 9999;
|
// z-index: 9999;
|
||||||
// border-radius: #{6 / $base-font-size}rem;
|
// border-radius: ${remSize(6)};
|
||||||
// -------------
|
|
||||||
// & li:first-child {
|
// & li:first-child {
|
||||||
// border-radius: #{5 / $base-font-size}rem #{5 / $base-font-size}rem 0 0;
|
// border-radius: ${remSize(5)} ${remSize(5)} 0 0;
|
||||||
// }
|
// }
|
||||||
// & li:last-child {
|
// & li:last-child {
|
||||||
// border-radius: 0 0 #{5 / $base-font-size}rem #{5 / $base-font-size}rem;
|
// border-radius: 0 0 ${remSize(5)} ${remSize(5)};
|
||||||
// }
|
// }
|
||||||
|
// -------------
|
||||||
// & li {
|
// & li {
|
||||||
// & button,
|
// & button,
|
||||||
// & a {
|
// & a {
|
||||||
|
@ -74,9 +76,9 @@ import { remSize, prop, common } from '../theme';
|
||||||
// }
|
// }
|
||||||
// width: 100%;
|
// width: 100%;
|
||||||
// text-align: left;
|
// text-align: left;
|
||||||
// padding: #{8 / $base-font-size}rem #{16 / $base-font-size}rem;
|
// padding: ${remSize(8)} ${remSize(16)};
|
||||||
// }
|
// }
|
||||||
// height: #{35 / $base-font-size}rem;
|
// height: ${remSize(35)};
|
||||||
// cursor: pointer;
|
// cursor: pointer;
|
||||||
// display: flex;
|
// display: flex;
|
||||||
// align-items: center;
|
// align-items: center;
|
||||||
|
@ -105,10 +107,10 @@ import { remSize, prop, common } from '../theme';
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
const DropdownWrapper = styled.div`
|
const DropdownWrapper = styled.ul`
|
||||||
background-color: ${prop('Modal.background')};
|
background-color: ${prop('Modal.background')};
|
||||||
border: 1px solid ${prop('Modal.border')};
|
border: 1px solid ${prop('Modal.border')};
|
||||||
box-shadow: 0 0 18px 0 ${common.shadowColor};
|
box-shadow: 0 0 18px 0 ${prop('shadowColor')};
|
||||||
color: ${prop('primaryTextColor')};
|
color: ${prop('primaryTextColor')};
|
||||||
|
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
@ -120,45 +122,68 @@ const DropdownWrapper = styled.div`
|
||||||
height: auto;
|
height: auto;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
border-radius: ${remSize(6)};
|
border-radius: ${remSize(6)};
|
||||||
|
|
||||||
|
& li:first-child { border-radius: ${remSize(5)} ${remSize(5)} 0 0; }
|
||||||
|
& li:last-child { border-radius: 0 0 ${remSize(5)} ${remSize(5)}; }
|
||||||
|
|
||||||
|
& li:hover {
|
||||||
|
|
||||||
|
background-color: ${prop('Button.hover.background')};
|
||||||
|
color: ${prop('Button.hover.foreground')};
|
||||||
|
|
||||||
|
& button, & a {
|
||||||
|
color: ${prop('Button.hover.foreground')};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
height: ${remSize(36)};
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
& button,
|
||||||
|
& a {
|
||||||
|
color: ${prop('primaryTextColor')};
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
padding: ${remSize(8)} ${remSize(16)};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
// { onPress
|
||||||
|
// ? <IconButton
|
||||||
|
// : <Link to={to}>{title}</Link>}
|
||||||
|
|
||||||
// @include themify() {
|
const MaybeIcon = (Element, label) => Element && <Element aria-label={label} />;
|
||||||
// background-color: map-get($theme-map, 'modal-background-color');
|
|
||||||
// border: 1px solid map-get($theme-map, 'modal-border-color');
|
|
||||||
// box-shadow: 0 0 18px 0 getThemifyVariable('shadow-color');
|
|
||||||
// color: getThemifyVariable('primary-text-color');
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
const Dropdown = ({ items }) => (
|
const Dropdown = ({ items }) => (
|
||||||
<DropdownWrapper>
|
<DropdownWrapper>
|
||||||
<h1>space</h1>
|
|
||||||
<h1>space</h1>
|
|
||||||
<h1>space</h1>
|
|
||||||
<h1>space</h1>
|
|
||||||
{/* className="nav__items-left" */}
|
{/* className="nav__items-left" */}
|
||||||
<ul className="nav__items-left nav__dropdown nav__item nav__item--open">
|
{items && items.map(({ title, icon, href }) => (
|
||||||
<h1 className="nav__dropdown-item">hello</h1>
|
<li key={`nav-${title && title.toLowerCase()}`}>
|
||||||
<h1 className="nav__dropdown-item">hello</h1>
|
<Link to={href}>
|
||||||
{items && items.map(({ title }) => (
|
{MaybeIcon(icon, `Navigate to ${title}`)}
|
||||||
<li className="nav__dropdown-item" key={`nav-${title && title.toLowerCase()}`}>
|
{title}
|
||||||
<h1>space</h1>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</ul>
|
|
||||||
</DropdownWrapper>
|
</DropdownWrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
Dropdown.propTypes = {
|
Dropdown.propTypes = {
|
||||||
items: PropTypes.arrayOf(PropTypes.shape({
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
action: PropTypes.func
|
action: PropTypes.func,
|
||||||
}))
|
icon: PropTypes.func,
|
||||||
|
href: PropTypes.string
|
||||||
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
Dropdown.defaultProps = {
|
Dropdown.defaultProps = {
|
||||||
items: []
|
items: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Dropdown;
|
export default Dropdown;
|
||||||
|
|
|
@ -58,7 +58,9 @@ const MobileIDEView = (props) => {
|
||||||
// const overlayActive = name => (overlay === name);
|
// const overlayActive = name => (overlay === name);
|
||||||
|
|
||||||
const headerNavOptions = [
|
const headerNavOptions = [
|
||||||
{ icon: PreferencesIcon, title: 'Preferences', route: '/mobile/preferences' }
|
{ icon: PreferencesIcon, title: 'Preferences', href: '/mobile/preferences' },
|
||||||
|
{ icon: PreferencesIcon, title: 'Examples', href: '/mobile/examples' },
|
||||||
|
{ icon: PreferencesIcon, title: 'Original View', href: '/mobile/preferences' }
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue