Skip to content

Commit 6ef54a5

Browse files
committed
feat(segment): add ionic theme styles
1 parent 7f54581 commit 6ef54a5

File tree

6 files changed

+82
-32
lines changed

6 files changed

+82
-32
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@
8484
z-index: 1;
8585
}
8686

87+
// Segment Button: Checked
88+
// --------------------------------------------------
89+
90+
:host(.segment-button-checked) {
91+
background: var(--background-checked);
92+
color: var(--color-checked);
93+
}
94+
95+
// Segment Button: Disabled
96+
// --------------------------------------------------
97+
98+
:host(.segment-button-disabled) {
99+
cursor: default;
100+
pointer-events: none;
101+
}
102+
87103
// Segment Button Icon
88104
// --------------------------------------------------
89105

@@ -153,7 +169,8 @@
153169
// --------------------------------------------------
154170

155171
.segment-button-indicator {
156-
// @include transform-origin(left);
172+
@include position(null, 0, 0, 0);
173+
@include transform-origin(left);
157174

158175
position: absolute;
159176

@@ -170,6 +187,8 @@
170187
width: 100%;
171188
height: var(--indicator-height);
172189

190+
background: var(--indicator-color);
191+
173192
transform: var(--indicator-transform);
174193

175194
box-shadow: var(--indicator-box-shadow);
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,68 @@
1+
@use "../../themes/ionic/ionic.globals.scss" as globals;
12
@import "./segment-button.common";
23

34
// Ionic Segment Button
45
// --------------------------------------------------
56

67
:host {
8+
--background: #{globals.$ionic-color-base-white};
9+
--background-checked: var(--background);
10+
--color: #{globals.$ionic-color-neutral-1000};
11+
--color-checked: #{globals.$ionic-color-primary-base};
12+
--color-disabled: #{globals.$ionic-color-neutral-500};
13+
--indicator-color: var(--color-checked);
14+
--indicator-height: #{globals.$ionic-border-size-025};
15+
--indicator-transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
16+
--indicator-transform: none;
17+
--padding-top: #{globals.$ionic-space-100};
18+
--padding-end: #{globals.$ionic-space-200};
19+
--padding-bottom: #{globals.$ionic-space-100};
20+
--padding-start: #{globals.$ionic-space-200};
21+
--transition: color 0.15s linear 0s, opacity 0.15s linear 0s;
722

23+
min-width: globals.$ionic-scale-1200;
24+
min-height: globals.$ionic-scale-1200;
25+
26+
border-bottom: globals.$ionic-border-size-025 globals.$ionic-border-style-solid globals.$ionic-color-neutral-300;
27+
}
28+
29+
.button-inner {
30+
@include padding(globals.$ionic-space-100, null, globals.$ionic-space-100, null);
31+
32+
gap: globals.$ionic-space-100;
33+
}
34+
35+
// Segment Button Label
36+
// --------------------------------------------------
37+
38+
::slotted(ion-label) {
39+
@include globals.typography(globals.$ionic-action-md);
40+
41+
color: var(--color);
42+
}
43+
44+
// Segment Button Icon
45+
// --------------------------------------------------
46+
47+
::slotted(ion-icon) {
48+
width: globals.$ionic-scale-600;
49+
height: globals.$ionic-scale-600;
50+
51+
color: var(--color);
52+
}
53+
54+
// Segment Button: Checked
55+
// --------------------------------------------------
56+
57+
:host(.segment-button-checked) ::slotted(ion-label),
58+
:host(.segment-button-checked) ::slotted(ion-icon) {
59+
color: var(--color-checked);
60+
}
61+
62+
// Segment Button: Disabled
63+
// --------------------------------------------------
64+
65+
:host(.segment-button-disabled) ::slotted(ion-label),
66+
:host(.segment-button-disabled) ::slotted(ion-icon) {
67+
color: var(--color-disabled);
868
}

core/src/components/segment-button/segment-button.ios.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,11 @@
100100

101101
.segment-button-indicator {
102102
@include padding(null, $segment-button-ios-margin);
103-
@include position(0, 0, 0, 0);
104103
}
105104

106105
.segment-button-indicator-background {
107106
@include border-radius(var(--border-radius));
108107

109-
background: var(--indicator-color);
110-
}
111-
112-
.segment-button-indicator-background {
113108
transition: var(--indicator-transition);
114109
}
115110

core/src/components/segment-button/segment-button.md.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,6 @@
177177
// Segment Button: Indicator
178178
// --------------------------------------------------
179179

180-
.segment-button-indicator {
181-
@include position(null, 0, 0, 0);
182-
}
183-
184-
.segment-button-indicator-background {
185-
background: var(--indicator-color);
186-
}
187-
188180
// Segment button indicator color should use the background checked variable with
189181
// a fallback to the default value of --indicator-color
190182
:host(.in-toolbar:not(.in-segment-color)) .segment-button-indicator-background {

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
--color: initial;
4747
--color-hover: var(--color);
4848
--color-checked: var(--color);
49-
--color-disabled: var(--color);
5049
--padding-start: 0;
5150
--padding-end: 0;
5251
--padding-top: 0;
@@ -61,22 +60,6 @@
6160
@include button-state();
6261
}
6362

64-
// Segment Button: Checked
65-
// --------------------------------------------------
66-
67-
:host(.segment-button-checked) {
68-
background: var(--background-checked);
69-
color: var(--color-checked);
70-
}
71-
72-
// Segment Button: Disabled
73-
// --------------------------------------------------
74-
75-
:host(.segment-button-disabled) {
76-
cursor: default;
77-
pointer-events: none;
78-
}
79-
8063
// Segment Button: Focused
8164
// --------------------------------------------------
8265

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
@use "../../themes/ionic/ionic.globals.scss" as globals;
12
@use "./segment.common";
23

34
// Ionic Segment
45
// --------------------------------------------------
56

67
:host {
7-
8+
--background: #{globals.$ionic-color-base-white};
89
}
910

0 commit comments

Comments
 (0)