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