Skip to content

Commit

Permalink
fix(dropdown): add z-index
Browse files Browse the repository at this point in the history
  • Loading branch information
zouxuoz committed Aug 24, 2018
1 parent 45905e2 commit 32a6c4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/atoms/Dropdown/DropdownBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Portal } from 'react-portal';
import { withDropdownContext } from './DropdownContext';
import { offsetSizes, defaultTheme, DropdownBodyTag } from './DropdownBody.theme';
import type { PropSizes } from '../../types';
import { Z_INDEX } from '../../theme/zIndex';

/**
* @prop {*} background options for background color
Expand Down Expand Up @@ -70,7 +71,7 @@ const dropdownBodyEnhancer: HOC<*, DropdownBodyProps> = compose(
type DropdownBodyEnhancedProps = HOCBase<typeof dropdownBodyEnhancer>;

class DropdownBodyBase extends PureComponent<DropdownBodyEnhancedProps> {
static zIndex = 2000;
static zIndex = Z_INDEX.DROPDOWN;

static defaultProps = {
...defaultTheme,
Expand Down
1 change: 1 addition & 0 deletions src/theme/zIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const Z_INDEX = {
MODAL: 10000,
DROPDOWN: 20000,
FIXED_NAV: 1000,
};

Expand Down
18 changes: 9 additions & 9 deletions storybook/__tests__/__snapshots__/storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8537,7 +8537,7 @@ exports[`Storyshots ATOMS/Dropdown default 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -8655,7 +8655,7 @@ exports[`Storyshots ATOMS/Dropdown with custom body width 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": "40rem",
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -8773,7 +8773,7 @@ exports[`Storyshots ATOMS/Dropdown with custom offset 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -8892,7 +8892,7 @@ exports[`Storyshots ATOMS/Dropdown with dark background 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -9010,7 +9010,7 @@ exports[`Storyshots ATOMS/Dropdown with force render 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -9128,7 +9128,7 @@ exports[`Storyshots ATOMS/Dropdown with pin to right 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -9340,7 +9340,7 @@ exports[`Storyshots ATOMS/Dropdown with stretch target 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -9458,7 +9458,7 @@ exports[`Storyshots ATOMS/Dropdown without background 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down Expand Up @@ -9576,7 +9576,7 @@ exports[`Storyshots ATOMS/Dropdown without close on outside click 1`] = `
"pointerEvents": "none",
"position": "absolute",
"width": undefined,
"zIndex": 2000,
"zIndex": 20000,
}
}
>
Expand Down

0 comments on commit 32a6c4c

Please sign in to comment.