Skip to content

Commit

Permalink
refactor: switch Alert to JSX
Browse files Browse the repository at this point in the history
  • Loading branch information
fboulnois committed Jan 22, 2024
1 parent d90a17b commit 2a2418d
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions src/components/Alert.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
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 {

render() {

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 const Alert = ({ id, type, title, description }) => {
return (
<div id={`${id}_alert`} className={`alert-wrapper ${type}`}>
{title && <h4 id={`${id}_title`} className="alert-title">{title}</h4>}
{description && <span id={`${id}_description`} className="alert-description">{description}</span>}
</div>
);
};

0 comments on commit 2a2418d

Please sign in to comment.