Allow creating label without name

This commit is contained in:
Maksim Eltyshev
2019-10-09 18:48:19 +05:00
parent b9d4024957
commit 4911816734
9 changed files with 31 additions and 51 deletions

View File

@@ -48,7 +48,7 @@ const Label = React.memo(({
className={classNames(styles.wrapper, onClick && styles.hoverable)}
style={style}
>
{name}
{name || '\u00A0'}
</div>
);
@@ -62,14 +62,15 @@ const Label = React.memo(({
});
Label.propTypes = {
name: PropTypes.string.isRequired,
color: PropTypes.oneOf(LabelColors.KEYS).isRequired, // TODO: without color
name: PropTypes.string,
color: PropTypes.oneOf(LabelColors.KEYS).isRequired,
size: PropTypes.oneOf(Object.values(SIZES)),
isDisabled: PropTypes.bool,
onClick: PropTypes.func,
};
Label.defaultProps = {
name: undefined,
size: SIZES.MEDIUM,
isDisabled: false,
onClick: undefined,