generated from gravity-ui/package-example
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added NotificationsPopupWrapper component + cleaned up the stor…
…ies and README.md
- Loading branch information
Showing
6 changed files
with
175 additions
and
139 deletions.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
src/components/Notifications/NotificationsPopupWrapper.tsx
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,25 @@ | ||
import React from 'react'; | ||
|
||
const WIDTH = '320px'; | ||
const HEIGHT = '470px'; | ||
|
||
type Props = React.PropsWithChildren<{ | ||
className?: string; | ||
style?: React.CSSProperties; | ||
fullHeight?: boolean; | ||
}>; | ||
|
||
export const NotificationsPopupWrapper = (props: Props) => { | ||
const {className, style, fullHeight = true, children} = props; | ||
|
||
const finalStyles = React.useMemo((): React.CSSProperties => { | ||
const heightStyles = fullHeight ? {height: HEIGHT} : {maxHeight: HEIGHT}; | ||
return {...heightStyles, width: WIDTH, overflowY: 'auto', ...style}; | ||
}, [fullHeight, style]); | ||
|
||
return ( | ||
<div className={className} style={finalStyles}> | ||
{children} | ||
</div> | ||
); | ||
}; |
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
Oops, something went wrong.