Skip to content

Commit 4127249

Browse files
authored
Merge pull request #6194 from pat270/LPD-68820
feat(@clayui/css): LPD-68820 Adds dividers for solid color buttons in…
2 parents 51296c9 + 932f7f8 commit 4127249

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

packages/clay-css/src/scss/cadmin/components/_button-groups.scss

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,43 @@
148148
}
149149
}
150150
}
151+
152+
%clay-btn-group-divider {
153+
$_not-first-of-type: map-get(
154+
$cadmin-clay-btn-group-divider,
155+
'&:not(:first-of-type)'
156+
);
157+
158+
@if ($_not-first-of-type) {
159+
&:not(:first-of-type) {
160+
@include clay-css($_not-first-of-type);
161+
}
162+
}
163+
164+
$_not-last-of-type: map-get(
165+
$cadmin-clay-btn-group-divider,
166+
'&:not(:last-of-type)'
167+
);
168+
169+
@if ($_not-last-of-type) {
170+
&:not(:last-of-type) {
171+
@include clay-css($_not-last-of-type);
172+
}
173+
}
174+
}
175+
176+
.btn-group {
177+
@each $name, $value in $cadmin-btn-group-palette {
178+
@if not clay-is-map-unset($value) {
179+
$selector: if(
180+
starts-with($name, 'btn'),
181+
str-insert($name, '.', 1),
182+
$name
183+
);
184+
185+
#{$selector} {
186+
@include clay-button-variant($value);
187+
}
188+
}
189+
}
190+
}

packages/clay-css/src/scss/cadmin/variables/_buttons.scss

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,44 @@ $cadmin-btn-group-spaced: map-merge(
394394
$cadmin-btn-group-spaced
395395
);
396396

397+
$cadmin-clay-btn-group-divider: () !default;
398+
$cadmin-clay-btn-group-divider: map-deep-merge(
399+
(
400+
'&:not(:first-of-type)': (
401+
border-left-color: $cadmin-white,
402+
),
403+
'&:not(:last-of-type)': (
404+
border-right-color: $cadmin-white,
405+
),
406+
),
407+
$cadmin-clay-btn-group-divider
408+
);
409+
410+
$cadmin-btn-group-palette: () !default;
411+
$cadmin-btn-group-palette: map-deep-merge(
412+
(
413+
'> .btn-primary': (
414+
extend: '%clay-btn-group-divider',
415+
),
416+
'> .btn-info': (
417+
extend: '%clay-btn-group-divider',
418+
),
419+
'> .btn-success': (
420+
extend: '%clay-btn-group-divider',
421+
),
422+
'> .btn-warning': (
423+
extend: '%clay-btn-group-divider',
424+
),
425+
'> .btn-danger': (
426+
extend: '%clay-btn-group-divider',
427+
),
428+
'> .btn-dark': (
429+
extend: '%clay-btn-group-divider',
430+
),
431+
),
432+
$cadmin-btn-group-palette
433+
);
434+
397435
// Button Toolbar
398436

399437
$cadmin-btn-toolbar-spacer-x: 8px !default; // 8px

packages/clay-css/src/scss/components/_button-groups.scss

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
margin-left: math-sign($btn-border-width);
2929
}
3030

31+
> .btn::after {
32+
content: '';
33+
display: block;
34+
}
35+
3136
> .btn:not(:last-child):not(.dropdown-toggle),
3237
> .btn-group:not(:last-child) > .btn {
3338
@include border-right-radius(0);
@@ -206,3 +211,43 @@
206211
}
207212
}
208213
}
214+
215+
%clay-btn-group-divider {
216+
$_not-first-of-type: map-get(
217+
$clay-btn-group-divider,
218+
'&:not(:first-of-type)'
219+
);
220+
221+
@if ($_not-first-of-type) {
222+
&:not(:first-of-type) {
223+
@include clay-css($_not-first-of-type);
224+
}
225+
}
226+
227+
$_not-last-of-type: map-get(
228+
$clay-btn-group-divider,
229+
'&:not(:last-of-type)'
230+
);
231+
232+
@if ($_not-last-of-type) {
233+
&:not(:last-of-type) {
234+
@include clay-css($_not-last-of-type);
235+
}
236+
}
237+
}
238+
239+
.btn-group {
240+
@each $name, $value in $btn-group-palette {
241+
@if not clay-is-map-unset($value) {
242+
$selector: if(
243+
starts-with($name, 'btn'),
244+
str-insert($name, '.', 1),
245+
$name
246+
);
247+
248+
#{$selector} {
249+
@include clay-button-variant($value);
250+
}
251+
}
252+
}
253+
}

packages/clay-css/src/scss/variables/_buttons.scss

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,44 @@ $btn-group-spaced: map-merge(
386386
$btn-group-spaced
387387
);
388388

389+
$clay-btn-group-divider: () !default;
390+
$clay-btn-group-divider: map-deep-merge(
391+
(
392+
'&:not(:first-of-type)': (
393+
border-left-color: $white,
394+
),
395+
'&:not(:last-of-type)': (
396+
border-right-color: $white,
397+
),
398+
),
399+
$clay-btn-group-divider
400+
);
401+
402+
$btn-group-palette: () !default;
403+
$btn-group-palette: map-deep-merge(
404+
(
405+
'> .btn-primary': (
406+
extend: '%clay-btn-group-divider',
407+
),
408+
'> .btn-info': (
409+
extend: '%clay-btn-group-divider',
410+
),
411+
'> .btn-success': (
412+
extend: '%clay-btn-group-divider',
413+
),
414+
'> .btn-warning': (
415+
extend: '%clay-btn-group-divider',
416+
),
417+
'> .btn-danger': (
418+
extend: '%clay-btn-group-divider',
419+
),
420+
'> .btn-dark': (
421+
extend: '%clay-btn-group-divider',
422+
),
423+
),
424+
$btn-group-palette
425+
);
426+
389427
// Button Toolbar
390428

391429
$btn-toolbar-spacer-x: 0.5rem !default; // 8px

0 commit comments

Comments
 (0)