Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
<!-- Default -->
<span title="Default" data-view-component="true" class="State">Default state</span>
<!-- Open -->
<span title="Open" data-view-component="true" class="State State--open">Open state</span>
<!-- Closed -->
<span title="Closed" data-view-component="true" class="State State--closed">Closed state</span>
<!-- Merged -->
<span title="Merged" data-view-component="true" class="State State--merged">Merged state</span>
1
2
3
4
5
6
7
8
9
10
11
# Default
render(Primer::Beta::State.new(title: "Default")) { "Default state" }
# Open
render(Primer::Beta::State.new(title: "Open", scheme: :open)) { "Open state" }
# Closed
render(Primer::Beta::State.new(title: "Closed", scheme: :closed)) { "Closed state" }
# Merged
render(Primer::Beta::State.new(title: "Merged", scheme: :merged)) { "Merged state" }

app/components/primer/beta/state.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* State */
/* Default 32px */
.state, /* TODO: Deprecate */
.State {
display: inline-block;
padding: 5px var(--control-medium-paddingInline-normal);
font-size: var(--text-body-size-medium);
font-weight: var(--base-text-weight-medium);
line-height: var(--control-medium-lineBoxHeight);
text-align: center;
white-space: nowrap;
border-radius: 2em;
}
.state, /* TODO: Deprecate */
.State,
.State--draft {
color: var(--fgColor-onEmphasis);
background-color: var(--bgColor-neutral-emphasis);
border: var(--borderWidth-thin) solid transparent;
box-shadow: var(--boxShadow-thin) var(--borderColor-neutral-emphasis);
}
.State--open {
color: var(--fgColor-onEmphasis);
background-color: var(--bgColor-open-emphasis, var(--color-open-emphasis));
box-shadow: var(--boxShadow-thin) var(--borderColor-open-emphasis);
}
.State--merged {
color: var(--fgColor-onEmphasis);
background-color: var(--bgColor-done-emphasis, var(--color-done-emphasis));
box-shadow: var(--boxShadow-thin) var(--borderColor-done-emphasis);
}
.State--closed {
color: var(--fgColor-onEmphasis);
background-color: var(--bgColor-closed-emphasis, var(--color-closed-emphasis));
box-shadow: var(--boxShadow-thin) var(--borderColor-closed-emphasis);
}
/* Small 24px */
.State--small {
padding: 0 10px;
font-size: var(--text-body-size-small);
line-height: var(--base-size-24);
}
.State--small .octicon {
width: 1em; /* Ensures different icons don't change State indicator width */
}