hellowin/kanca

View on GitHub
src/infra/component/Alert.js

Summary

Maintainability
A
0 mins
Test Coverage
// @flow
import React from 'react';

export const AlertLevels = {
  INFO: 'INFO',
  SUCCESS: 'SUCCESS',
  WARNING: 'WARNING',
  DANGER: 'DANGER',
}

export type AlertLevel = $Keys<typeof AlertLevels>

export default (props: { level?: AlertLevel }) => {
  const { children, level } = { level: AlertLevels.INFO.toLowerCase(), ...props };
  return (
    <div className={`alert alert-${level.toLowerCase()}`} role="alert">
      {children}
    </div>
  );
}