-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,15 @@ | ||
import { Component } from 'react'; | ||
import { div, hh, h4, span } from 'react-hyperscript-helpers'; | ||
import React from 'react'; | ||
import './Alert.css'; | ||
|
||
export const Alert = hh(class Alert extends Component { | ||
export const Alert = (props) => { | ||
const { id, type, title, description } = props; | ||
|
||
render() { | ||
return ( | ||
<div id={`${id}_alert`} className={`alert-wrapper ${type}`}> | ||
{title !== undefined && <h4 id={`${id}_title`} className='alert-title'>{title}</h4>} | ||
{description !== undefined && <span id={`${id}_description`} className='alert-description'>{description}</span>} | ||
</div> | ||
); | ||
} | ||
|
||
return div({ | ||
id: this.props.id + '_alert', | ||
className: 'alert-wrapper ' + (this.props.type) | ||
}, [ | ||
h4({ | ||
id: this.props.id + '_title', | ||
className: 'alert-title', | ||
isRendered: this.props.title !== undefined | ||
}, [this.props.title]), | ||
span({ | ||
id: this.props.id + '_description', | ||
className: 'alert-description', | ||
isRendered: this.props.description !== undefined | ||
}, [this.props.description]), | ||
]); | ||
} | ||
|
||
}); | ||
export default Alert; |