Add defaultLabel for Labelled (#40)
* Add defaultLabel * Typing for defaultLabel * Add null for label prop * Try to fix (in the dark) * Allow anything for label
This commit is contained in:
parent
a4a83f9795
commit
1489a1c4e6
@ -9,21 +9,22 @@ import React from 'react';
|
||||
import Label from 'semantic-ui-react/dist/es/elements/Label';
|
||||
|
||||
type Props = BareProps & {
|
||||
label?: React$Node,
|
||||
// flowlint-next-line unclear-type:off
|
||||
label?: any,
|
||||
children: React$Node
|
||||
};
|
||||
|
||||
export default function Labelled ({ className, children, label, style }: Props): React$Node {
|
||||
const defaultLabel: React$Node = (
|
||||
<div> </div>
|
||||
);
|
||||
|
||||
export default function Labelled ({ className, children, label = defaultLabel, style }: Props): React$Node {
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
style={style}
|
||||
>
|
||||
<Label>{
|
||||
typeof label === 'undefined'
|
||||
? <div> </div>
|
||||
: label
|
||||
}</Label>
|
||||
<Label>{label}</Label>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user