Allow children-only InfoBox without msg prop
This commit is contained in:
parent
ec6e892aeb
commit
b225a21f41
@ -1,27 +1,19 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
interface InfoBoxProps {
|
||||
msg: string;
|
||||
msg?: string;
|
||||
}
|
||||
|
||||
const InfoBox: React.FC<InfoBoxProps> = (props) => (
|
||||
<Fragment>
|
||||
<>
|
||||
{
|
||||
(props.msg || props.children)?
|
||||
(
|
||||
(props.msg || props.children) &&
|
||||
<div className="alert alert-info" role="alert">
|
||||
{
|
||||
typeof props.msg === 'string' ?
|
||||
props.msg
|
||||
: 'Enjoy the colouring! Usual service should resume shortly.'
|
||||
}
|
||||
{
|
||||
props.children
|
||||
}
|
||||
{ props.msg ?? '' }
|
||||
{ props.children }
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
</Fragment>
|
||||
</>
|
||||
);
|
||||
|
||||
export default InfoBox;
|
||||
|
Loading…
Reference in New Issue
Block a user