|
|
|
@ -18,9 +18,13 @@ import { BodyText } from './Text'; |
|
|
|
|
|
|
|
|
|
type MessageBoxType = 'error' | 'info' | 'warning'; |
|
|
|
|
|
|
|
|
|
type MessageBoxProps = BoxProps & { |
|
|
|
|
type MessageBoxOptionalProps = { |
|
|
|
|
type?: MessageBoxType; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
type MessageBoxProps = BoxProps & |
|
|
|
|
MessageBoxOptionalProps & { |
|
|
|
|
text: string; |
|
|
|
|
type: MessageBoxType; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const MESSAGE_BOX_CLASS_PREFIX = 'MessageBox'; |
|
|
|
@ -37,8 +41,12 @@ const MESSAGE_BOX_TYPE_MAP_TO_ICON = { |
|
|
|
|
warning: <WarningIcon />, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const MESSAGE_BOX_DEFAULT_PROPS: Required<MessageBoxOptionalProps> = { |
|
|
|
|
type: 'info', |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const MessageBox = ({ |
|
|
|
|
type, |
|
|
|
|
type = MESSAGE_BOX_DEFAULT_PROPS.type, |
|
|
|
|
text, |
|
|
|
|
...boxProps |
|
|
|
|
}: MessageBoxProps): JSX.Element => { |
|
|
|
@ -105,6 +113,8 @@ const MessageBox = ({ |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
MessageBox.defaultProps = MESSAGE_BOX_DEFAULT_PROPS; |
|
|
|
|
|
|
|
|
|
export type { MessageBoxProps, MessageBoxType }; |
|
|
|
|
|
|
|
|
|
export default MessageBox; |
|
|
|
|