Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 5 additions & 0 deletions .changeset/cuddly-worms-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on my last comment, maybe this is worth a minor? But let me know what you think! 😁

---

Fixes multiple styling issues in the Token component.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/react/src/Token/Token.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

.Token:where([data-is-selected='true']) {
color: var(--fgColor-default);
border-style: solid;
border-color: var(--borderColor-emphasis);
}

.Token[data-is-remove-btn='true'] {
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/Token/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {clsx} from 'clsx'
export interface TokenProps extends TokenBaseProps {
/**
* A component that renders before the token text
* disabled when size is 'small'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that any tokens using leading visuals and have a size of "small" will no longer render the leading visual?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that’s correct! as requested in the issue:
"small variant of the token should use not allow for leadingVisuals"

*/
leadingVisual?: React.ElementType
}
Expand Down Expand Up @@ -71,7 +72,7 @@ const Token = forwardRef((props, forwardedRef) => {
ref={forwardedRef}
style={{borderWidth: `${tokenBorderWidthPx}px`, ...style}}
>
{LeadingVisual ? (
{LeadingVisual && size !== 'small' ? (
<LeadingVisualContainer size={size}>
<LeadingVisual />
</LeadingVisualContainer>
Expand Down
10 changes: 5 additions & 5 deletions packages/react/src/Token/TokenBase.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
.TokenBase:where([data-size='medium']) {
width: auto;
height: var(--base-size-20);
padding-right: var(--base-size-8);
padding-left: var(--base-size-8);
padding-right: var(--base-size-4);
padding-left: var(--base-size-4);
font-size: var(--text-body-size-small);
}

Expand All @@ -40,15 +40,15 @@
height: var(--base-size-24);
padding-right: var(--base-size-8);
padding-left: var(--base-size-8);
font-size: var(--text-body-size-small);
font-size: var(--text-body-size-medium);
}

.TokenBase[data-size='xlarge'] {
width: auto;
height: var(--base-size-32);
padding-top: 0;
padding-right: var(--base-size-16);
padding-right: var(--base-size-12);
padding-bottom: 0;
padding-left: var(--base-size-16);
padding-left: var(--base-size-12);
font-size: var(--text-body-size-medium);
}
4 changes: 2 additions & 2 deletions packages/react/src/Token/_RemoveTokenButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const RemoveTokenButton = ({
transform: `translate(${borderOffset}px, -${borderOffset}px)`,
}}
>
<XIcon size={size === 'small' || size === 'medium' || size === 'large' ? 12 : 16} />
<XIcon size={size === 'small' || size === 'medium' ? 12 : 16} />
</span>
)
}
Expand All @@ -55,7 +55,7 @@ const RemoveTokenButton = ({
ref={rest.ref as React.Ref<HTMLButtonElement>}
type="button"
>
<XIcon size={size === 'small' || size === 'medium' || size === 'large' ? 12 : 16} />
<XIcon size={size === 'small' || size === 'medium' ? 12 : 16} />
</button>
)
}
Expand Down
Loading