Skip to content

Commit

Permalink
fix: Layer visibilities (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
RabbitDoge authored Nov 10, 2020
1 parent 37f13c3 commit 6fbe6d5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Dropdown/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Default: React.FC = () => {
return (
<div>
<Dropdown target={<Button>Hover</Button>}>
{[...Array(6)].map(() => (
{[...Array(20)].map(() => (
<div>Content</div>
))}
</Dropdown>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const DropdownContent = styled.div`
box-shadow: ${({ theme }) => theme.shadows.level1};
padding: 16px;
border-radius: 16px;
max-height: 250px;
overflow-y: auto;
z-index: ${({ theme }) => theme.zIndices.modal};
`;

const Container = styled.div`
Expand Down
6 changes: 6 additions & 0 deletions src/theme/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ const radii = {
circle: "50%",
};

const zIndices = {
dropdown: 10,
modal: 100,
};

export default {
siteWidth: 1200,
breakpoints,
mediaQueries,
spacing,
shadows,
radii,
zIndices,
};
6 changes: 6 additions & 0 deletions src/theme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export type Colors = {
textSubtle: string;
};

export type ZIndices = {
dropdown: number;
modal: number;
};

export interface PancakeTheme {
siteWidth: number;
isDark: boolean;
Expand All @@ -62,4 +67,5 @@ export interface PancakeTheme {
spacing: Spacing;
shadows: Shadows;
radii: Radii;
zIndices: ZIndices;
}
2 changes: 1 addition & 1 deletion src/widgets/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const StyledModal = styled.div`
border: 1px solid rgba(14, 14, 44, 0.05);
border-radius: 32px;
width: 100%;
z-index: 11;
z-index: ${({ theme }) => theme.zIndices.modal};
overflow-y: auto;
${({ theme }) => theme.mediaQueries.xs} {
width: auto;
Expand Down
1 change: 1 addition & 0 deletions src/widgets/Modal/ModalContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ModalWrapper = styled.div`
right: 0;
bottom: 0;
left: 0;
z-index: ${({ theme }) => theme.zIndices.modal - 1};
`;

interface ModalsContext {
Expand Down

0 comments on commit 6fbe6d5

Please sign in to comment.