Skip to content

Commit bee20eb

Browse files
committed
fix button tokens architecture
1 parent 32e9822 commit bee20eb

File tree

4 files changed

+54
-25
lines changed

4 files changed

+54
-25
lines changed

core/src/components/button/button.common.scss

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import "../../themes/mixins";
2-
@import "./button.vars";
2+
@import "../../themes/functions.color";
33

44
// Button
55
// --------------------------------------------------
@@ -70,23 +70,12 @@
7070
pointer-events: none;
7171
}
7272

73-
// Solid Button
74-
// --------------------------------------------------
75-
76-
// Default Solid Color
77-
:host(.button-solid) {
78-
--background: #{ion-color(primary, base)};
79-
--color: #{ion-color(primary, contrast)};
80-
}
81-
8273
// Outline Button
8374
// --------------------------------------------------
8475

8576
// Default Outline Color
8677
:host(.button-outline) {
87-
--border-color: #{ion-color(primary, base)};
8878
--background: transparent;
89-
--color: #{ion-color(primary, base)};
9079
}
9180

9281
// Clear Button
@@ -96,7 +85,6 @@
9685
:host(.button-clear) {
9786
--border-width: 0;
9887
--background: transparent;
99-
--color: #{ion-color(primary, foreground)};
10088
}
10189

10290
// Block Button
@@ -327,8 +315,6 @@ ion-ripple-effect {
327315
}
328316

329317
:host ::slotted(ion-badge[vertical]:not(:empty)) {
330-
@include padding($button-badge-padding);
331-
332318
display: flex;
333319

334320
align-items: center;

core/src/components/button/button.ionic.scss

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
// Button Fills
4040
// -------------------------------------------------------------------------------
4141

42+
// Default Clear Color
43+
:host(.button-clear) {
44+
--color: #{ion-color(primary, foreground)};
45+
}
46+
47+
4248
// Solid Button
4349
// --------------------------------------------------
4450

@@ -47,6 +53,8 @@
4753
--background-hover: #{globals.ion-color(primary, shade)};
4854
--background-focused: transparent;
4955
--background-hover-opacity: 1;
56+
--background: #{globals.ion-color(primary, base)};
57+
--color: #{globals.ion-color(primary, contrast)};
5058
--ripple-opacity: var(--background-activated-opacity, 1);
5159
--ripple-color: var(--background-activated);
5260
}
@@ -61,6 +69,8 @@
6169
--background-focused: transparent;
6270
--background-hover: #{globals.$ion-bg-neutral-subtlest-press};
6371
--background-hover-opacity: 1;
72+
--border-color: #{globals.ion-color(primary, base)};
73+
--color: #{globals.ion-color(primary, base)};
6474
--ripple-opacity: var(--background-activated-opacity, 1);
6575
--ripple-color: var(--background-activated);
6676
}
@@ -73,6 +83,7 @@
7383
--background-focused: transparent;
7484
--background-hover: #{globals.$ion-bg-neutral-subtlest-press};
7585
--background-hover-opacity: 1;
86+
--color: #{globals.ion-color(primary, foreground)};
7687
--ripple-opacity: var(--background-activated-opacity, 1);
7788
--ripple-color: var(--background-activated);
7889
}
@@ -240,8 +251,11 @@
240251
// Button: Disabled
241252
// --------------------------------------------------
242253

243-
:host(.button-disabled) {
244-
opacity: 0.6;
254+
:host(.button-disabled) .button-native::after {
255+
@include globals.disabled-state();
256+
257+
width: inherit;
258+
height: inherit;
245259
}
246260

247261
// Button Icons
@@ -288,3 +302,9 @@
288302
:host(.button-xlarge) ::slotted(ion-spinner[slot="end"]) {
289303
@include globals.margin-horizontal(globals.$ion-space-300, null);
290304
}
305+
306+
// Button Badge
307+
// --------------------------------------------------
308+
:host ::slotted(ion-badge[vertical]:not(:empty)) {
309+
@include globals.padding(globals.$ion-space-050);
310+
}

core/src/components/button/button.native.scss

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use "../../themes/native/native.globals.md" as globals;
1+
@use "../../themes/native/native.globals" as globals;
22
@use "./button.common";
33

44
// Button - iOS and Material Design
@@ -8,6 +8,32 @@
88
font-family: globals.$font-family-base;
99
}
1010

11+
// Solid Button
12+
// --------------------------------------------------
13+
14+
// Default Solid Color
15+
:host(.button-solid) {
16+
--background: #{globals.ion-color(primary, base)};
17+
--color: #{globals.ion-color(primary, contrast)};
18+
}
19+
20+
// Outline Button
21+
// --------------------------------------------------
22+
23+
// Default Outline Color
24+
:host(.button-outline) {
25+
--border-color: #{globals.ion-color(primary, base)};
26+
--color: #{globals.ion-color(primary, base)};
27+
}
28+
29+
// Clear Button
30+
// --------------------------------------------------
31+
32+
// Default Clear Color
33+
:host(.button-clear) {
34+
--color: #{globals.ion-color(primary, foreground)};
35+
}
36+
1137
// Button Icons
1238
// --------------------------------------------------
1339

@@ -29,3 +55,7 @@
2955
.button-native ::slotted(ion-badge) {
3056
position: fixed;
3157
}
58+
59+
:host ::slotted(ion-badge[vertical]:not(:empty)) {
60+
@include globals.padding(2px);
61+
}

core/src/components/button/button.vars.scss

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)