Skip to content

Commit

Permalink
feat: Enable readOnly for pills without buttons (#396)
Browse files Browse the repository at this point in the history
* feat: Enable readOnly for pills when no buttons are present in them

Co-authored-by: sunny <sunny@MacBook-Pro-Sunny-Zhang-W1Y9W09WW0.local>
  • Loading branch information
szhang-eightfold and sunny authored Sep 29, 2022
1 parent d363abb commit 66954ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/Pills/Pill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export const Pill: FC<PillProps> = React.forwardRef(
{ [styles.xsmall]: size === PillSize.XSmall },
{ [styles.tagPillsDisabled]: mergedDisabled },
{ [styles.tagPillsRtl]: htmlDir === 'rtl' },
{
[styles.readOnly]:
type !== PillType.withButton && type !== PillType.closable,
},
]);
return (
<div
Expand Down
5 changes: 5 additions & 0 deletions src/components/Pills/pills.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
}
}

&.readOnly {
cursor: default;
pointer-events: none;
}

&.xsmall {
background: none;
border: none;
Expand Down

0 comments on commit 66954ef

Please sign in to comment.