Make title prop as node in PopupWindow component

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2022-01-29 13:45:36 +05:30
parent fb0a0b0dc2
commit 8c013aa2a9

View file

@ -54,6 +54,7 @@ function PopupWindow({
onRequestClose, children, onRequestClose, children,
}) { }) {
const haveDrawer = drawer !== null; const haveDrawer = drawer !== null;
const cTitle = contentTitle !== null ? contentTitle : title;
return ( return (
<RawModal <RawModal
@ -68,7 +69,11 @@ function PopupWindow({
<Header> <Header>
<IconButton size="small" src={ChevronLeftIC} onClick={onRequestClose} tooltip="Back" /> <IconButton size="small" src={ChevronLeftIC} onClick={onRequestClose} tooltip="Back" />
<TitleWrapper> <TitleWrapper>
<Text variant="s1" weight="medium" primary>{twemojify(title)}</Text> {
typeof title === 'string'
? <Text variant="s1" weight="medium" primary>{twemojify(title)}</Text>
: title
}
</TitleWrapper> </TitleWrapper>
{drawerOptions} {drawerOptions}
</Header> </Header>
@ -84,7 +89,11 @@ function PopupWindow({
<div className="pw__content"> <div className="pw__content">
<Header> <Header>
<TitleWrapper> <TitleWrapper>
<Text variant="h2" weight="medium" primary>{twemojify(contentTitle !== null ? contentTitle : title)}</Text> {
typeof cTitle === 'string'
? <Text variant="h2" weight="medium" primary>{twemojify(cTitle)}</Text>
: cTitle
}
</TitleWrapper> </TitleWrapper>
{contentOptions} {contentOptions}
</Header> </Header>
@ -113,8 +122,8 @@ PopupWindow.defaultProps = {
PopupWindow.propTypes = { PopupWindow.propTypes = {
className: PropTypes.string, className: PropTypes.string,
isOpen: PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
title: PropTypes.string.isRequired, title: PropTypes.node.isRequired,
contentTitle: PropTypes.string, contentTitle: PropTypes.node,
drawer: PropTypes.node, drawer: PropTypes.node,
drawerOptions: PropTypes.node, drawerOptions: PropTypes.node,
contentOptions: PropTypes.node, contentOptions: PropTypes.node,