Skip to content

Commit 156b2ad

Browse files
authored
Merge branch 'develop' into chore/authentication-improvements
2 parents ac6a5a8 + 17b2470 commit 156b2ad

File tree

37 files changed

+809
-398
lines changed

37 files changed

+809
-398
lines changed

client/common/icons.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Exit from '../images/exit.svg';
1212
import DropdownArrow from '../images/down-filled-triangle.svg';
1313
import Preferences from '../images/preferences.svg';
1414
import Play from '../images/triangle-arrow-right.svg';
15+
import More from '../images/more.svg';
1516
import Code from '../images/code.svg';
1617
import Terminal from '../images/terminal.svg';
1718

@@ -77,4 +78,6 @@ export const ExitIcon = withLabel(Exit);
7778
export const DropdownArrowIcon = withLabel(DropdownArrow);
7879
export const PreferencesIcon = withLabel(Preferences);
7980
export const PlayIcon = withLabel(Play);
81+
export const MoreIcon = withLabel(More);
8082
export const TerminalIcon = withLabel(Terminal);
83+
export const CodeIcon = withLabel(Code);

client/components/Dropdown.jsx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { Link } from 'react-router';
4+
import styled from 'styled-components';
5+
import { remSize, prop, common } from '../theme';
6+
import IconButton from './mobile/IconButton';
7+
import Button from '../common/Button';
8+
9+
const DropdownWrapper = styled.ul`
10+
background-color: ${prop('Modal.background')};
11+
border: 1px solid ${prop('Modal.border')};
12+
box-shadow: 0 0 18px 0 ${prop('shadowColor')};
13+
color: ${prop('primaryTextColor')};
14+
15+
position: absolute;
16+
right: ${props => (props.right ? 0 : 'initial')};
17+
left: ${props => (props.left ? 0 : 'initial')};
18+
19+
${props => (props.align === 'right' && 'right: 0;')}
20+
${props => (props.align === 'left' && 'left: 0;')}
21+
22+
23+
text-align: left;
24+
width: ${remSize(180)};
25+
display: flex;
26+
flex-direction: column;
27+
height: auto;
28+
z-index: 9999;
29+
border-radius: ${remSize(6)};
30+
31+
& li:first-child { border-radius: ${remSize(5)} ${remSize(5)} 0 0; }
32+
& li:last-child { border-radius: 0 0 ${remSize(5)} ${remSize(5)}; }
33+
34+
& li:hover {
35+
36+
background-color: ${prop('Button.hover.background')};
37+
color: ${prop('Button.hover.foreground')};
38+
39+
& button, & a {
40+
color: ${prop('Button.hover.foreground')};
41+
}
42+
}
43+
44+
li {
45+
height: ${remSize(36)};
46+
cursor: pointer;
47+
display: flex;
48+
align-items: center;
49+
50+
& button,
51+
& a {
52+
color: ${prop('primaryTextColor')};
53+
width: 100%;
54+
text-align: left;
55+
padding: ${remSize(8)} ${remSize(16)};
56+
}
57+
}
58+
`;
59+
60+
// TODO: Add Icon to the left of the items in the menu
61+
// const MaybeIcon = (Element, label) => Element && <Element aria-label={label} />;
62+
63+
const Dropdown = ({ items, align }) => (
64+
<DropdownWrapper align={align} >
65+
{/* className="nav__items-left" */}
66+
{items && items.map(({ title, icon, href }) => (
67+
<li key={`nav-${title && title.toLowerCase()}`}>
68+
<Link to={href}>
69+
{/* {MaybeIcon(icon, `Navigate to ${title}`)} */}
70+
{title}
71+
</Link>
72+
</li>
73+
))
74+
}
75+
</DropdownWrapper>
76+
);
77+
78+
Dropdown.propTypes = {
79+
align: PropTypes.oneOf(['left', 'right']),
80+
items: PropTypes.arrayOf(PropTypes.shape({
81+
action: PropTypes.func,
82+
icon: PropTypes.func,
83+
href: PropTypes.string
84+
})),
85+
};
86+
87+
Dropdown.defaultProps = {
88+
items: [],
89+
align: null
90+
};
91+
92+
export default Dropdown;

0 commit comments

Comments
 (0)