-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…on (#358)
- Loading branch information
1 parent
8326375
commit 8428570
Showing
27 changed files
with
1,845 additions
and
1,664 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { createPortal } from 'react-dom' | ||
import { createUseStyles } from 'react-jss' | ||
import { popoverPalette } from 'components/Popover/utils' | ||
import { useCreateDomElement } from 'components/utils' | ||
import React, { FC, ReactNode } from 'react' | ||
import { styleguide, ThemeType } from 'components/assets/styles' | ||
|
||
const { flexCenter } = styleguide | ||
|
||
const { dark, light } = ThemeType | ||
|
||
const useStyles = createUseStyles({ | ||
container: { | ||
...flexCenter, | ||
background: popoverPalette[light].background, | ||
bottom: 0, | ||
display: ({ isPopoverOpen }) => (isPopoverOpen ? 'flex' : 'none'), | ||
height: '100%', | ||
left: 0, | ||
position: 'fixed', | ||
right: 0, | ||
top: 0, | ||
width: '100%', | ||
zIndex: 10 | ||
}, | ||
// eslint-disable-next-line sort-keys | ||
'@global': { | ||
[`.${dark}`]: { | ||
'& $container': { | ||
background: popoverPalette[dark].background | ||
} | ||
} | ||
} | ||
}) | ||
|
||
interface Props { | ||
children: ReactNode | ||
isPopoverOpen?: boolean | ||
} | ||
|
||
export const FilterModal: FC<Props> = ({ children, isPopoverOpen }: Props) => { | ||
const classes = useStyles({ isPopoverOpen }) | ||
|
||
const rootElement = useCreateDomElement('filters-modal-root') | ||
|
||
return ( | ||
rootElement && | ||
createPortal( | ||
<div className={classes.container}>{children}</div>, | ||
rootElement | ||
) | ||
) | ||
} |
Oops, something went wrong.