Skip to content

Commit 5aa343e

Browse files
committed
refactor(item-option): only apply the color / background to hue classes
1 parent bffa469 commit 5aa343e

File tree

5 files changed

+68
-37
lines changed

5 files changed

+68
-37
lines changed

core/src/components/item-option/item-option.scss renamed to core/src/components/item-option/item-option.common.scss

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1-
@import "./item-option.vars";
1+
@import "../../themes/mixins";
22

3-
// Item Option
3+
// Common Item Option
44
// --------------------------------------------------
55

66
:host {
77
/**
88
* @prop --background: Background of the item option
99
* @prop --color: Color of the item option
1010
*/
11-
--background: #{ion-color(primary, base)};
12-
--color: #{ion-color(primary, contrast)};
13-
1411
background: var(--background);
1512
color: var(--color);
16-
17-
font-family: $font-family-base;
18-
}
19-
20-
:host(.ion-color) {
21-
background: current-color(base);
22-
color: current-color(contrast);
2313
}
2414

2515
.button-native {
2616
@include text-inherit();
27-
@include padding(0, 0.7em);
2817

2918
display: inline-block;
3019

@@ -72,23 +61,6 @@
7261
flex-shrink: 0;
7362
}
7463

75-
::slotted([slot="start"]) {
76-
@include margin(0, 5px, 0, 0);
77-
}
78-
79-
::slotted([slot="end"]) {
80-
@include margin(0, 0, 0, 5px);
81-
}
82-
83-
::slotted([slot="icon-only"]) {
84-
@include padding(0);
85-
@include margin(0, 10px);
86-
87-
min-width: 0.9em;
88-
89-
font-size: 1.8em;
90-
}
91-
9264
// Item Expandable Animation
9365
// --------------------------------------------------
9466

@@ -100,7 +72,7 @@
10072
transition-timing-function: cubic-bezier(0.65, 0.05, 0.36, 1);
10173
}
10274

103-
// Item Disabled Styling
75+
// Item Option: Disabled
10476
// --------------------------------------------------
10577

10678
:host(.item-option-disabled) {
@@ -109,6 +81,5 @@
10981

11082
:host(.item-option-disabled) .button-native {
11183
cursor: default;
112-
opacity: 0.5;
11384
pointer-events: none;
11485
}

core/src/components/item-option/item-option.ionic.scss

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@use "../../themes/ionic/ionic.globals.scss" as globals;
2-
@import "./item-option";
2+
@use "./item-option.common";
33

44
// Ionic Item Option
55
// --------------------------------------------------
@@ -29,11 +29,11 @@
2929
}
3030

3131
::slotted([slot="start"]) {
32-
@include margin(0, globals.$ion-space-100, 0, 0);
32+
@include globals.margin(0, globals.$ion-space-100, 0, 0);
3333
}
3434

3535
::slotted([slot="end"]) {
36-
@include margin(0, 0, 0, globals.$ion-space-100);
36+
@include globals.margin(0, 0, 0, globals.$ion-space-100);
3737
}
3838

3939
::slotted(ion-icon),
@@ -89,3 +89,17 @@
8989
background: globals.current-color(base, $subtle: true);
9090
color: globals.current-color(contrast, $subtle: true);
9191
}
92+
93+
// Bold Item Option
94+
// --------------------------------------------------
95+
96+
:host(.item-option-bold) {
97+
--background: #{globals.ion-color(primary, base)};
98+
--background-activated: #{globals.ion-color(primary, shade)};
99+
--color: #{globals.ion-color(primary, contrast)};
100+
}
101+
102+
:host(.item-option-bold.ion-color) {
103+
background: globals.current-color(base);
104+
color: globals.current-color(contrast);
105+
}

core/src/components/item-option/item-option.ios.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "./item-option";
1+
@import "./item-option.native";
22
@import "./item-option.ios.vars";
33

44
// iOS Item Option

core/src/components/item-option/item-option.md.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "./item-option";
1+
@import "./item-option.native";
22
@import "./item-option.md.vars";
33

44
// Material Design Item Option
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@import "../../themes/native/native.globals";
2+
@import "./item-option.vars";
3+
@import "./item-option.common";
4+
5+
// Native Item Option
6+
// --------------------------------------------------
7+
8+
:host {
9+
--background: #{ion-color(primary, base)};
10+
--color: #{ion-color(primary, contrast)};
11+
12+
font-family: $font-family-base;
13+
}
14+
15+
:host(.ion-color) {
16+
background: current-color(base);
17+
color: current-color(contrast);
18+
}
19+
20+
.button-native {
21+
@include padding(0, 0.7em);
22+
}
23+
24+
::slotted([slot="start"]) {
25+
@include margin(0, 5px, 0, 0);
26+
}
27+
28+
::slotted([slot="end"]) {
29+
@include margin(0, 0, 0, 5px);
30+
}
31+
32+
::slotted([slot="icon-only"]) {
33+
@include padding(0);
34+
@include margin(0, 10px);
35+
36+
min-width: 0.9em;
37+
38+
font-size: 1.8em;
39+
}
40+
41+
// Item Option: Disabled
42+
// --------------------------------------------------
43+
44+
:host(.item-option-disabled) .button-native {
45+
opacity: 0.5;
46+
}

0 commit comments

Comments
 (0)