Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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/grumpy-cats-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": major
---

Remove `variant` prop from KeybindingHint Chord component
15 changes: 0 additions & 15 deletions packages/react/src/KeybindingHint/components/Chord.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,11 @@
font-size: var(--text-body-size-small);
padding: var(--base-size-4);
line-height: 10px; /* stylelint-disable-line primer/typography */
}

.ChordNormal {
background: var(--bgColor-transparent);
color: var(--fgColor-muted);
border-color: var(--borderColor-default);
}

.ChordOnEmphasis {
background: var(--counter-bgColor-emphasis);
color: var(--fgColor-onEmphasis);
border-color: transparent;
}

.ChordOnPrimary {
background: var(--button-primary-bgColor-active);
color: var(--fgColor-onEmphasis);
border-color: transparent;
}

.ChordSmall {
border-radius: var(--borderRadius-small);
font-size: 11px; /* stylelint-disable-line primer/typography */
Expand Down
5 changes: 1 addition & 4 deletions packages/react/src/KeybindingHint/components/Chord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@ const splitChord = (chord: string) =>
.map(k => k.toLowerCase())
.sort(compareLowercaseKeys)

export const Chord = ({keys, format = 'condensed', variant = 'normal', size = 'normal'}: KeybindingHintProps) => (
export const Chord = ({keys, format = 'condensed', size = 'normal'}: KeybindingHintProps) => (
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 the "variant" prop in KeyBindingHint will be a no-op? Not sure we should remove this without a major 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I did add a major changeset as it is breaking. FWIW I'm removing calls from dotcom in this PR but probably safe to put this in the next major anyway! https://github.com/github/github-ui/pull/7169

<Text
data-kbd-chord
className={clsx(classes.Chord, {
[classes.ChordNormal]: variant === 'normal',
[classes.ChordOnEmphasis]: variant === 'onEmphasis',
[classes.ChordOnPrimary]: variant === 'onPrimary',
[classes.ChordSmall]: size === 'small',
})}
>
Expand Down
6 changes: 6 additions & 0 deletions packages/react/src/TooltipV2/Tooltip.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@
content: '';
}

& [data-kbd-chord] {
background: var(--counter-bgColor-emphasis);
color: var(--fgColor-onEmphasis);
border-color: transparent;
}

/* Only show animations if users don't have a preference for reduced motion */
@media screen and (prefers-reduced-motion: no-preference) {
/* Animation styles */
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/TooltipV2/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export const Tooltip: ForwardRefExoticComponent<
<VisuallyHidden>({getAccessibleKeybindingHintString(keybindingHint, isMacOS)})</VisuallyHidden>
</span>
<span className={clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore)} aria-hidden>
<KeybindingHint keys={keybindingHint} format="condensed" variant="onEmphasis" size="small" />
<KeybindingHint keys={keybindingHint} format="condensed" size="small" />
</span>
</>
) : (
Expand Down
Loading