Add ability to pass node in dialog title

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2022-02-20 20:13:59 +05:30
parent 76a5c99b08
commit 44544f3289

View file

@ -27,7 +27,11 @@ function Dialog({
<div className="dialog__content"> <div className="dialog__content">
<Header> <Header>
<TitleWrapper> <TitleWrapper>
<Text variant="h2" weight="medium" primary>{twemojify(title)}</Text> {
typeof title === 'string'
? <Text variant="h2" weight="medium" primary>{twemojify(title)}</Text>
: title
}
</TitleWrapper> </TitleWrapper>
{contentOptions} {contentOptions}
</Header> </Header>
@ -56,7 +60,7 @@ Dialog.defaultProps = {
Dialog.propTypes = { Dialog.propTypes = {
className: PropTypes.string, className: PropTypes.string,
isOpen: PropTypes.bool.isRequired, isOpen: PropTypes.bool.isRequired,
title: PropTypes.string.isRequired, title: PropTypes.node.isRequired,
contentOptions: PropTypes.node, contentOptions: PropTypes.node,
onAfterOpen: PropTypes.func, onAfterOpen: PropTypes.func,
onAfterClose: PropTypes.func, onAfterClose: PropTypes.func,