Previews

No matching results.

x
1
2
3
4
5
6
7
8
<!-- Default -->
<span title="1,000" data-view-component="true" class="Counter">1,000</span>
<!-- Primary -->
<span title="1,000" data-view-component="true" class="Counter Counter--primary">1,000</span>
<!-- Secondary -->
<span title="1,000" data-view-component="true" class="Counter Counter--secondary">1,000</span>
1
2
3
4
5
6
7
8
# Default
render(Primer::Beta::Counter.new(count: 1_000))
# Primary
render(Primer::Beta::Counter.new(count: 1_000, scheme: :primary))
# Secondary
render(Primer::Beta::Counter.new(count: 1_000, scheme: :secondary))

app/components/primer/beta/counter.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Counter */
.Counter {
display: inline-block;
min-width: var(--base-size-20); /* makes sure it's a circle with just one digit */
padding: 0 6px;
font-size: var(--text-body-size-small);
font-weight: var(--base-text-weight-medium);
line-height: calc(var(--base-size-20) - var(--borderWidth-thin) * 2); /* 20px - 2px for the borders */
color: var(--fgColor-default);
text-align: center;
background-color: var(--bgColor-neutral-muted, var(--color-neutral-muted));
border: var(--borderWidth-thin) solid var(--counter-borderColor);
border-radius: 2em;
}
.Counter:empty {
display: none;
}
/* Is this selector used? could not find any use of it */
.Counter .octicon {
vertical-align: text-top;
opacity: 0.8;
}
.Counter--primary {
color: var(--fgColor-onEmphasis);
background-color: var(--bgColor-neutral-emphasis);
}
.Counter--secondary {
color: var(--fgColor-muted);
background-color: var(--bgColor-neutral-muted);
}