Skip to content
Merged
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/spicy-pants-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Update CSS styles for CounterLabel to allow overrides for color, background color
6 changes: 3 additions & 3 deletions packages/react/src/CounterLabel/CounterLabel.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
/* stylelint-disable-next-line primer/borders */
border-radius: 20px;

&[data-scheme='primary'] {
&:where([data-scheme='primary']) {
color: var(--fgColor-onEmphasis);
background-color: var(--bgColor-neutral-emphasis);
}

&[data-scheme='secondary'] {
&:where([data-scheme='secondary']) {
color: var(--fgColor-default);
background-color: var(--bgColor-neutral-muted);
}

&:empty {
&:where(:empty) {
display: none;
}
}
11 changes: 7 additions & 4 deletions packages/react/src/CounterLabel/CounterLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,24 @@ const StyledCounterLabel = styled.span`
border-radius: 20px;
border: var(--borderWidth-thin, max(1px, 0.0625rem)) solid var(--counter-borderColor, var(--color-counter-border));

&[data-scheme='primary'] {
&:where([data-scheme='primary']) {
background-color: ${get('colors.neutral.emphasis')};
color: ${get('colors.fg.onEmphasis')};
}

&[data-scheme='secondary'] {
&:where([data-scheme='secondary']) {
background-color: ${get('colors.neutral.muted')};
color: ${get('colors.fg.default')};
}

&:empty {
&:where(:empty) {
display: none;
}

${sx}
/* Place the sx prop styles after previously inserted styles so that it will win out in specificity */
& {
${sx}
}
`

CounterLabel.displayName = 'CounterLabel'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`CounterLabel renders with secondary scheme when no "scheme" prop is pro
border: var(--borderWidth-thin,max(1px,0.0625rem)) solid var(--counter-borderColor,var(--color-counter-border));
}

.c0:empty {
.c0:where(:empty) {
display: none;
}

Expand Down Expand Up @@ -64,7 +64,7 @@ exports[`CounterLabel respects the primary "scheme" prop 1`] = `
border: var(--borderWidth-thin,max(1px,0.0625rem)) solid var(--counter-borderColor,var(--color-counter-border));
}

.c0:empty {
.c0:where(:empty) {
display: none;
}

Expand Down
Loading