Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pill: ensure pill heights match latest design specification #626

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/Pills/Pill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const Pill: FC<PillProps> = React.forwardRef(

const labelClassNames: string = mergeClasses([
styles.label,
{ [styles.large]: size === PillSize.Large },
{ [styles.medium]: size === PillSize.Medium },
{ [styles.small]: size === PillSize.Small },
{ [styles.xsmall]: size === PillSize.XSmall },
Expand All @@ -73,6 +74,9 @@ export const Pill: FC<PillProps> = React.forwardRef(
styles.tagPills,
classNames,
(styles as any)[theme],
{ [styles.large]: size === PillSize.Large },
{ [styles.medium]: size === PillSize.Medium },
{ [styles.small]: size === PillSize.Small },
{ [styles.xsmall]: size === PillSize.XSmall },
{ [styles.tagPillsDisabled]: mergedDisabled },
{ [styles.tagPillsRtl]: htmlDir === 'rtl' },
Expand Down
12 changes: 6 additions & 6 deletions src/components/Pills/__snapshots__/Pill.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Pill Pill should render as closable 1`] = `
<div>
<div
class="tag-pills blue"
class="tag-pills blue medium"
>
<span
class="label medium"
Expand Down Expand Up @@ -38,7 +38,7 @@ exports[`Pill Pill should render as closable 1`] = `
exports[`Pill Pill should render normally 1`] = `
<div>
<div
class="tag-pills blue read-only"
class="tag-pills blue medium read-only"
>
<span
class="label medium"
Expand All @@ -52,7 +52,7 @@ exports[`Pill Pill should render normally 1`] = `
exports[`Pill Pill should render with a theme 1`] = `
<div>
<div
class="tag-pills white read-only"
class="tag-pills white medium read-only"
>
<span
class="label medium"
Expand All @@ -66,7 +66,7 @@ exports[`Pill Pill should render with a theme 1`] = `
exports[`Pill Pill should render with button 1`] = `
<div>
<div
class="tag-pills blue"
class="tag-pills blue medium"
>
<span
class="label medium"
Expand Down Expand Up @@ -109,7 +109,7 @@ exports[`Pill Pill should render with button 1`] = `
exports[`Pill Pill should render with icon 1`] = `
<div>
<div
class="tag-pills blue read-only"
class="tag-pills blue medium read-only"
>
<span
aria-hidden="false"
Expand Down Expand Up @@ -139,7 +139,7 @@ exports[`Pill Pill should render with icon 1`] = `
exports[`Pill Pill should render with icon to the end of its label 1`] = `
<div>
<div
class="tag-pills blue read-only"
class="tag-pills blue medium read-only"
>
<span
class="label medium"
Expand Down
34 changes: 29 additions & 5 deletions src/components/Pills/pills.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
--label: var(--blue-color);
--hover-bg: var(--blue-color-30);
--hover-label: var(--text-primary-color);
padding: $space-xxs $space-s;
border-radius: $border-radius-m;
padding: 5px $space-xs;
border-radius: 6px;
dkilgore-eightfold marked this conversation as resolved.
Show resolved Hide resolved
transition: all $motion-duration-extra-fast $motion-easing-easeinout 0s;
background: var(--bg);
color: var(--label);
Expand All @@ -13,17 +13,23 @@
align-items: center;

.label {
font-family: $octuple-font-family;
font-size: $text-font-size-5;
font-family: var(--font-stack-full);
font-weight: $text-font-weight-semibold;

&.large {
font-size: $text-font-size-5;
line-height: $text-line-height-3;
}

&.medium {
font-size: $text-font-size-3;
line-height: $text-line-height-2;
}

&.small,
&.xsmall {
font-size: $text-font-size-2;
line-height: $text-line-height-1;
}

&.line-clamp {
Expand Down Expand Up @@ -120,7 +126,25 @@
--bg: var(--white-color);
--label: var(--grey-color-60);
--hover-bg: var(--grey-color-10);
border: 1px solid var(--grey-color-60);

&:not(.xsmall) {
border: 1px solid var(--grey-color-60);
dkilgore-eightfold marked this conversation as resolved.
Show resolved Hide resolved
}
}

&.large {
padding: 10px $space-xs;
}

&.medium {
border-radius: 6px;
padding: 5px $space-xs;
}

&.small,
&.xsmall {
border-radius: $border-radius-s;
padding: $space-xxs $space-xxs;
}

&:hover:not(.tag-pills-disabled) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Select/__snapshots__/Select.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`Select Renders with default values when multiple 1`] = `
class="multi-select-pills"
>
<div
class="tag-pills multi-select-pill blue-green"
class="tag-pills multi-select-pill blue-green medium"
id="selectPillOption 2-1"
style="visibility: hidden;"
>
Expand Down Expand Up @@ -114,7 +114,7 @@ exports[`Select Renders with default values when multiple 1`] = `
</button>
</div>
<div
class="tag-pills multi-select-pill blue-green"
class="tag-pills multi-select-pill blue-green medium"
id="selectPillOption 3-2"
style="visibility: hidden;"
>
Expand Down