Skip to content

Commit

Permalink
Add min fixed width to counter digits
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongarciah committed Feb 25, 2025
1 parent ab39665 commit 2002c5f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
color: var(--color-gray-900);
user-select: none;

& span {
font-variant-numeric: tabular-nums;
display: inline-block;
text-align: end;
min-width: 2.5ch;
}

@media (hover: hover) {
&:hover {
background-color: var(--color-gray-100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ function Counter(props: CounterProps) {
props: {
...otherProps,
type: 'button',
children: `Counter: ${count}`,
children: (
<React.Fragment>
Counter: <span>{count}</span>
</React.Fragment>
),
onClick: () => setCount((prev) => prev + 1),
'aria-label': `Count is ${count}, click to increase`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
color: var(--color-gray-900);
user-select: none;

& span {
font-variant-numeric: tabular-nums;
display: inline-block;
text-align: end;
min-width: 2.5ch;
}

@media (hover: hover) {
&:hover {
background-color: var(--color-gray-100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ function Counter(props: CounterProps) {
props: {
...otherProps,
type: 'button',
children: `Counter: ${count}`,
children: (
<React.Fragment>
Counter: <span>{count}</span>
</React.Fragment>
),
onClick: () => setCount((prev) => prev + 1),
'aria-label': `Count is ${count}, click to increase`,
},
Expand Down

0 comments on commit 2002c5f

Please sign in to comment.