Skip to content

Commit

Permalink
improve the logic of our dropdown positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Erickson committed Dec 6, 2017
1 parent 4fca039 commit a923ed8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/App/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export default class Header extends React.Component {
<Dropdown
classNameButton="nc-appHeader-button nc-appHeader-quickNew"
label="Quick add"
dropdownTopOverlap="30px"
dropdownWidth="160px"
dropdownPosition="right"
dropdownPosition="left"
>
{
collections.filter(collection => collection.get('create')).toList().map(collection =>
Expand All @@ -90,6 +91,7 @@ export default class Header extends React.Component {
: null
}
<Dropdown
dropdownTopOverlap="50px"
dropdownWidth="100px"
dropdownPosition="right"
button={
Expand Down
3 changes: 2 additions & 1 deletion src/components/UI/Dropdown/Dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@

.nc-dropdownList {
@apply(--dropdownList);
margin: 0;
position: absolute;
top: 39px;
top: 0;
left: 0;
min-width: 100%;
z-index: 1;
Expand Down
2 changes: 2 additions & 0 deletions src/components/UI/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ const Dropdown = ({
classNameButton = '',
dropdownWidth = 'auto',
dropdownPosition = 'left',
dropdownTopOverlap = '0',
children
}) => {
const style = {
width: dropdownWidth,
top: dropdownTopOverlap,
left: dropdownPosition === 'left' ? 0 : 'auto',
right: dropdownPosition === 'right' ? 0 : 'auto',
};
Expand Down

0 comments on commit a923ed8

Please sign in to comment.