diff --git a/packages/ui-toolkit/src/index.js b/packages/ui-toolkit/src/index.js index da8ebdfb..04679490 100644 --- a/packages/ui-toolkit/src/index.js +++ b/packages/ui-toolkit/src/index.js @@ -20,7 +20,6 @@ export { default as Divider } from './divider'; export { default as Editor } from './editor'; export { default as IconButton } from './icon-button'; export { default as StatusLoader } from './status-loader'; -export { default as Message } from './message'; export { default as Slider } from './slider'; export { MetricGraph } from './metrics'; @@ -91,6 +90,12 @@ export { Item as HeaderItem } from './header'; +export { + default as Message, + Title as MessageTitle, + Description as MessageDescription +} from './message'; + export { default as SectionList, Item as SectionListItem, diff --git a/packages/ui-toolkit/src/message/Readme.md b/packages/ui-toolkit/src/message/Readme.md index 48af0b19..b0728c0f 100644 --- a/packages/ui-toolkit/src/message/Readme.md +++ b/packages/ui-toolkit/src/message/Readme.md @@ -1,20 +1,32 @@ #### Success/Educational ``` -{}} title="Choosing deployement data center"> -Not all data centres have all configurations of instances available. Make sure that you choose the data center that suits your requirements. Learn more" +const { Title, Description } = require('.'); + + + Choosing deployment data center + Not all data centres have all configurations of instances available. Make sure that you choose the data center that suits your requirements. Learn more ``` #### Error ``` -{}} title="Choosing deployement data center" error message="Oh no"/> +const { Title, Description } = require('.'); + + + Choosing deployment data center + Oh no + ``` #### Warning ``` -{}} title="Choosing deployement data center" warning message="There were some issues"/> -``` +const { Title, Description } = require('.'); + + Choosing deployment data center + There were some issues + +``` diff --git a/packages/ui-toolkit/src/message/index.js b/packages/ui-toolkit/src/message/index.js index 6e68f42a..8b96fc52 100644 --- a/packages/ui-toolkit/src/message/index.js +++ b/packages/ui-toolkit/src/message/index.js @@ -10,7 +10,7 @@ import P from '../text/p'; import CloseButton from '../close-button'; import { border, bottomShaddow } from '../boxes'; -const StyledContainer = styled.div` +const Container = styled.div` position: relative; margin-bottom: ${unitcalc(2)}; background-color: ${props => props.theme.white}; @@ -20,53 +20,41 @@ const StyledContainer = styled.div` display: flex; `; -const StyledColor = styled.div` +const Color = styled.div` min-width: ${remcalc(36)}; margin-right: ${remcalc(18)}; min-height: 100%; background-color: ${props => props.theme.green}; + ${is('error')` background-color: ${props => props.theme.red}; `}; + ${is('warning')` background-color: ${props => props.theme.orange}; `}; `; -const StyledMessageContainer = styled.div` - padding: ${unitcalc(2)} 0 ${unitcalc(2.25)} 0; -`; +const Outlet = styled.div`padding: ${unitcalc(2)} 0 ${unitcalc(2.25)} 0;`; -const StyledClose = styled(CloseButton)` +const Close = styled(CloseButton)` position: absolute; right: ${unitcalc(0.5)}; top: ${unitcalc(0.5)}; `; -const Message = ({ title, message, onCloseClick, children, ...type }) => { - const renderTitle = title ?

{title}

: null; +const Message = ({ onCloseClick = () => null, children, ...type }) => ( + + + {children} + +); - const renderClose = onCloseClick ? ( - - ) : null; +export const Title = ({ children }) =>

{children}

; - return ( - - -
- - {renderTitle} -

{message || children}

-
-
- {renderClose} -
- ); -}; +export const Description = ({ children }) =>

{children}

; Message.propTypes = { - title: PropTypes.string, - message: PropTypes.string, onCloseClick: PropTypes.func, error: PropTypes.bool, warning: PropTypes.bool,