Skip to content

Commit

Permalink
fix(tag): add title to tags (#6112)
Browse files Browse the repository at this point in the history
* fix(tag): add prop to enable title on tags

* chore(tests): update snapshots

* fix(tag): enable title by default

* fix(tag): set title by default

* chore(test): update snapshots
  • Loading branch information
tw15egan authored May 28, 2020
1 parent c9efab2 commit 7935ad4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/react/src/components/Tag/Tag-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const props = {
)
),
disabled: boolean('Disabled (disabled)', false),
title: 'Clear Filter',
title: text('Title (title)', 'Clear Filter'),
}),
filter() {
return {
Expand All @@ -44,7 +44,7 @@ storiesOf('Tag', module)
'Default',
() => (
<Tag className="some-class" {...props.regular()}>
{text('Content (children)', 'This is not a tag')}
{text('Content (children)', 'This is a tag')}
</Tag>
),
{
Expand All @@ -61,7 +61,7 @@ storiesOf('Tag', module)
'Filter',
() => (
<Tag className="some-class" {...props.filter()} filter>
{text('Content (children)', 'This is not a tag')}
{text('Content (children)', 'This is a tag')}
</Tag>
),
{
Expand Down
12 changes: 9 additions & 3 deletions packages/react/src/components/Tag/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,25 @@ const Tag = ({
}
id={tagId}
{...other}>
<span className={`${prefix}--tag__label`}>
<span
className={`${prefix}--tag__label`}
title={typeof children === 'string' ? children : null}>
{children !== null && children !== undefined ? children : TYPES[type]}
</span>
<button
className={`${prefix}--tag__close-icon`}
onClick={handleClose}
disabled={disabled}
aria-labelledby={tagId}>
aria-labelledby={tagId}
title={title}>
<Close16 />
</button>
</div>
) : (
<span className={tagClasses} {...other}>
<span
className={tagClasses}
title={typeof children === 'string' ? children : null}
{...other}>
{children !== null && children !== undefined ? children : TYPES[type]}
</span>
);
Expand Down

0 comments on commit 7935ad4

Please sign in to comment.