Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
fix(components): prettify code (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleyva authored Dec 18, 2018
1 parent 6e1aa36 commit 318e472
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
46 changes: 29 additions & 17 deletions src/components/BannerMessage/BannerMessage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ import classnames from 'classnames'
*/

const BannerMessage = props => {
const { className, button, closed, header, icon, children, info, warning, error, success, onCloseClicked, ...rest } = props
const {
className,
button,
closed,
header,
icon,
children,
info,
warning,
error,
success,
onCloseClicked,
...rest
} = props
const forceInfo = !info && !warning && !error && !success

function getOneDismissElement () {
Expand Down Expand Up @@ -42,28 +55,27 @@ const BannerMessage = props => {
<BannerMessageHeader>{headerContent}</BannerMessageHeader>
)
const alertIcon = (
<i className={classnames('banner-message__alert', {
'icon_check_alt2': success,
'ei icon_info_alt': info || forceInfo,
'ei icon_error-triangle_alt': warning,
'ei icon_error-circle_alt': error
})} />
<i
className={classnames('banner-message__alert', {
icon_check_alt2: success,
'ei icon_info_alt': info || forceInfo,
'ei icon_error-triangle_alt': warning,
'ei icon_error-circle_alt': error
})}
/>
)
const DismissElement = getOneDismissElement()

return (
<div className={classnames('banner-message__wrapper', className)}>
<div
className={classnames(
'banner-message',
{
info: info || forceInfo,
success,
error,
warning,
closed
}
)}
className={classnames('banner-message', {
info: info || forceInfo,
success,
error,
warning,
closed
})}
{...rest}
>
{alertIcon}
Expand Down
5 changes: 4 additions & 1 deletion src/components/unstable/Layout/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ Layout.propTypes = {
}
Layout.Header = generic({ name: 'LayoutHeader', className: 'layout__header' })
Layout.Nav = generic({ name: 'LayoutNav', className: 'layout__nav' })
Layout.Notification = generic({ name: 'LayoutNotification', className: 'layout__notification' })
Layout.Notification = generic({
name: 'LayoutNotification',
className: 'layout__notification'
})
Layout.Body = generic({ name: 'LayoutBody', className: 'layout__body' })

0 comments on commit 318e472

Please sign in to comment.