@stackoverflow/stacks 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  // visit https://stackoverflow.design/
8
8
  //
9
9
  // ============================================================================
10
- // UTLITY OVERRIDES
10
+ // UTILITY OVERRIDES
11
11
  // Instead of re-adding colors to unique class names, use these atomic classes
12
12
  // for text and background colors
13
13
  // ============================================================================
@@ -19,7 +19,7 @@
19
19
  // Number counts
20
20
  &&__rep,
21
21
  &&__rep-down,
22
- &&__votes,
22
+ &&__votes:not(&__answered),
23
23
  // Users
24
24
  &&__admin,
25
25
  &&__moderator,
@@ -76,7 +76,7 @@
76
76
  }
77
77
  &&__rep,
78
78
  &&__rep-down,
79
- &&__votes {
79
+ &&__votes:not(&__answered) {
80
80
  --_ba-bg: var(--white);
81
81
  }
82
82
  &&__answered {
@@ -96,7 +96,7 @@
96
96
  --_ba-bc: var(--red-400);
97
97
  --_ba-fc: var(--red-500);
98
98
  }
99
- &&__votes {
99
+ &&__votes:not(&__answered) {
100
100
  --_ba-bc: var(--black-150);
101
101
  --_ba-fc: var(--black-700);
102
102
  }
@@ -1,104 +1,80 @@
1
- //
2
- // STACK OVERFLOW
3
- // BUTTON GROUPS
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // TABLE OF CONTENTS
10
- // • BUTTON GROUP CONTAINER
11
-
12
- // ============================================================================
13
- // $ CONTAINER
14
- // ----------------------------------------------------------------------------
15
1
  .s-btn-group {
16
- display: flex;
17
- flex-wrap: wrap;
18
- margin-bottom: 1px; // Compensate for buttons having a margin bottom of -1px to account for row wrapping
19
-
20
- .s-btn {
21
- margin-bottom: -1px; // When wrapping we need to account for the border
22
- white-space: nowrap; // When the buttons wrap, they get super tall and mess up the whole layout
2
+ // CONTEXTUAL STYLES
3
+ #stacks-internals #screen-sm({
4
+ .s-btn {
5
+ &.s-btn__dropdown {
6
+ padding-right: 1.2em;
23
7
 
24
- // If it isn't the last button, we should slide the button over to account for border thickness
25
- &:not(:last-child) {
26
- margin-right: -1px;
27
- }
8
+ &:after {
9
+ right: 0.4em;
10
+ }
11
+ }
28
12
 
29
- // We don't want border-radii on interior buttons
30
- &:not(:first-child):not(:last-child) {
31
- border-radius: 0;
13
+ padding-left: 0.4em;
14
+ padding-right: 0.4em;
32
15
  }
16
+ }, @force-selector: true);
33
17
 
34
- // Kill the right border radius on the first button
35
- &:first-child:not(:only-child) {
36
- border-top-right-radius: 0;
37
- border-bottom-right-radius: 0;
38
- }
18
+ // VARIANTS
19
+ &:not(&--radio) .s-btn:not(:first-child):not(:last-child),
20
+ &&--radio .s-btn:not(:first-of-type):not(:last-of-type) {
21
+ border-radius: 0;
22
+ }
39
23
 
40
- // Kill the left border radius on the last button
41
- &:last-child:not(:only-child) {
42
- border-top-left-radius: 0;
43
- border-bottom-left-radius: 0;
44
- }
24
+ &:not(&--radio) .s-btn:first-child:not(:only-child),
25
+ &&--radio .s-btn:first-of-type:not(:last-of-type) {
26
+ border-top-right-radius: 0;
27
+ border-bottom-right-radius: 0;
28
+ }
45
29
 
46
- // When the button is active or selected, it should pop above its siblings
47
- &.is-selected {
48
- z-index: var(--zi-selected);
49
- }
30
+ &:not(&--radio) .s-btn:last-child:not(:only-child),
31
+ &&--radio .s-btn:last-of-type:not(:first-of-type) {
32
+ border-top-left-radius: 0;
33
+ border-bottom-left-radius: 0;
34
+ }
50
35
 
51
- .highcontrast-mode({
52
- &.is-selected {
53
- background-color: var(--black-400);
54
- color: var(--white);
36
+ &:not(&--radio) .s-btn:not(:last-child),
37
+ &&--radio .s-btn:not(:last-of-type) {
38
+ margin-right: calc(var(--su-static1) * -1);
39
+ }
55
40
 
56
- .s-btn--number {
57
- color: var(--black);
58
- }
41
+ // CHILD ELEMENTS
42
+ form {
43
+ &:not(:first-child):not(:last-child) {
44
+ .s-btn {
45
+ border-radius: 0;
59
46
  }
60
- });
61
-
62
- &:active {
63
- z-index: var(--zi-active);
64
47
  }
65
-
66
- #stacks-internals #screen-sm({
67
- padding-left: 0.4em;
68
- padding-right: 0.4em;
69
- }, @force-selector: true);
70
- }
71
-
72
- #stacks-internals #screen-sm({
73
- .s-btn.s-btn__dropdown {
74
- padding-right: 1.2em;
75
-
76
- &:after {
77
- right: 0.4em;
48
+ &:last-child:not(:only-child) {
49
+ .s-btn:not(:last-child) {
50
+ border-radius: 0;
51
+ }
52
+ }
53
+ &:first-child:not(:only-child) {
54
+ .s-btn:not(:first-child) {
55
+ border-radius: 0;
78
56
  }
79
57
  }
80
- }, @force-selector: true);
81
58
 
82
- .s-btn-group--container {
83
59
  display: flex;
60
+ margin-right: calc(var(--su-static1) * -1); // -1px
61
+ }
84
62
 
85
- .s-btn {
86
- margin-right: -1px; // We should slide buttons over to account for border thickness
63
+ .s-btn {
64
+ &:active {
65
+ z-index: var(--zi-active);
87
66
  }
88
-
89
- &:not(:first-child):not(:last-child) .s-btn {
90
- border-radius: 0;
67
+ &.is-selected,
68
+ &--radio:checked + .s-btn {
69
+ z-index: var(--zi-selected); // When the button is active or selected, it should pop above its siblings
91
70
  }
92
71
 
93
- &:first-child .s-btn {
94
- border-top-right-radius: 0;
95
- border-bottom-right-radius: 0;
96
- margin-left: 0;
97
- }
98
-
99
- &:last-child .s-btn {
100
- border-top-left-radius: 0;
101
- border-bottom-left-radius: 0;
102
- }
72
+ margin-bottom: calc(var(--su-static1) * -1); // When wrapping we need to account for the border
73
+ white-space: nowrap; // When the buttons wrap, they get super tall and mess up the whole layout
103
74
  }
75
+
76
+ // STATIC COMPONENT STYLES
77
+ display: flex;
78
+ flex-wrap: wrap;
79
+ margin-bottom: var(--su-static1); // Compensate for buttons having a margin bottom of -1px to account for row wrapping
104
80
  }