fix(striker-ui): default MessageBox type to 'info'

main
Tsu-ba-me 3 years ago
parent 1414117ac1
commit 1690349011
  1. 16
      striker-ui/components/MessageBox.tsx

@ -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;

Loading…
Cancel
Save