import React from 'react' ; import t from 'prop-types' ; export interface AlertProps { description default kind ? : 'info' | 'positive' | 'negative' | 'warning' ; } export type KindMap = Record < Required < AlertProps > [ 'kind' ] , string > ; const prefixCls = 'happy-alert' ; const kinds = { info : '#5352ED' , positive : '#2ED573' , negative : '#FF4757' , warning : '#FFA502' , } ; const Alert = ( { children , kind = 'info' , ... rest } ) => ( < div className = { prefixCls } style = { { background : kinds [ kind ] , } } { ... rest } > { children } < /div>); Alert . propTypes = { kind : t . oneOf ( [ 'info' , 'positive' , 'negative' , 'warning' ] ) , } ; export default Alert ;