Skip to content

Commit 1ebb063

Browse files
committed
refactor(datetime): update ionic styles for footer buttons
1 parent a1f3fcc commit 1ebb063

File tree

30 files changed

+44
-20
lines changed

30 files changed

+44
-20
lines changed

core/src/components/buttons/buttons.ionic.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// --------------------------------------------------
1414

1515
::slotted(*) .button-clear {
16-
--color: globals.$ion-primitives-neutral-1200;
16+
--color: #{globals.$ion-primitives-neutral-1200};
1717
--background: transparent;
1818
--background-activated: transparent;
1919
--background-focused: transparent;

core/src/components/datetime/datetime.common.scss

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -153,30 +153,15 @@
153153
overflow: hidden;
154154
}
155155

156-
// Calendar / Header / Action Buttons
156+
// Calendar / Footer / Action Buttons
157157
// -----------------------------------
158158

159159
:host .datetime-action-buttons.has-clear-button {
160160
width: 100%;
161161
}
162162

163-
:host .datetime-action-buttons ion-buttons {
164-
display: flex;
165-
166-
justify-content: space-between;
167-
}
168-
169-
/**
170-
* The confirm and clear buttons are grouped in a
171-
* container so that they appear on the end opposite
172-
* of the cancel button.
173-
* We use display: flex so that the
174-
* wrapper only takes up as much
175-
* height as it needs.
176-
*/
177-
.datetime-action-buttons .datetime-action-buttons-container {
178-
display: flex;
179-
}
163+
// Calendar / Header / Action Buttons
164+
// -----------------------------------
180165

181166
/**
182167
* Date/Year button should be on

core/src/components/datetime/datetime.ionic.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,16 @@
200200
background-color: globals.$ion-primitives-neutral-100;
201201
color: globals.$ion-primitives-neutral-1200;
202202
}
203+
204+
// Calendar / Footer / Action Buttons
205+
// -----------------------------------
206+
207+
:host .datetime-buttons ion-buttons {
208+
display: block;
209+
}
210+
211+
:host .datetime-buttons ion-buttons ion-button {
212+
@include globals.typography(globals.$ion-body-action-lg);
213+
214+
min-height: globals.$ion-space-1200;
215+
}

core/src/components/datetime/datetime.native.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,24 @@ ion-picker {
118118
--highlight-border-radius: var(--wheel-highlight-border-radius);
119119
--fade-background-rgb: var(--wheel-fade-background-rgb);
120120
}
121+
122+
// Calendar / Footer / Action Buttons
123+
// -----------------------------------
124+
125+
:host .datetime-action-buttons ion-buttons {
126+
display: flex;
127+
128+
justify-content: space-between;
129+
}
130+
131+
/**
132+
* The confirm and clear buttons are grouped in a
133+
* container so that they appear on the end opposite
134+
* of the cancel button.
135+
* We use display: flex so that the
136+
* wrapper only takes up as much
137+
* height as it needs.
138+
*/
139+
.datetime-action-buttons .datetime-action-buttons-container {
140+
display: flex;
141+
}

core/src/components/datetime/datetime.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,7 @@ export class Datetime implements ComponentInterface {
15161516
*/
15171517

15181518
private renderFooter() {
1519+
const theme = getIonTheme(this);
15191520
const { disabled, readonly, showDefaultButtons, showClearButton } = this;
15201521
/**
15211522
* The cancel, clear, and confirm buttons
@@ -1557,6 +1558,7 @@ export class Datetime implements ComponentInterface {
15571558
color={this.color}
15581559
onClick={() => this.cancel(true)}
15591560
disabled={isButtonDisabled}
1561+
expand={theme === 'ionic' ? 'full' : undefined}
15601562
>
15611563
{this.cancelText}
15621564
</ion-button>
@@ -1568,6 +1570,7 @@ export class Datetime implements ComponentInterface {
15681570
color={this.color}
15691571
onClick={() => clearButtonClick()}
15701572
disabled={isButtonDisabled}
1573+
expand={theme === 'ionic' ? 'full' : undefined}
15711574
>
15721575
{this.clearText}
15731576
</ion-button>
@@ -1578,6 +1581,8 @@ export class Datetime implements ComponentInterface {
15781581
color={this.color}
15791582
onClick={() => this.confirm(true)}
15801583
disabled={isButtonDisabled}
1584+
expand={theme === 'ionic' ? 'full' : undefined}
1585+
fill={theme === 'ionic' ? 'solid' : undefined}
15811586
>
15821587
{this.doneText}
15831588
</ion-button>

core/src/components/datetime/test/basic/datetime.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
251251
});
252252
});
253253

254-
configs().forEach(({ title, screenshot, config }) => {
254+
configs({ modes: ['ios', 'md', 'ionic-md'] }).forEach(({ title, screenshot, config }) => {
255255
test.describe(title('datetime: footer'), () => {
256256
test('should render default buttons', async ({ page }) => {
257257
await page.setContent('<ion-datetime value="2022-05-03" show-default-buttons="true"></ion-datetime>', config);
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)