Skip to content

Commit 0cc29b0

Browse files
author
Tanner Reits
committed
feat(modal): ionic theme styles
1 parent 4814caa commit 0cc29b0

File tree

2 files changed

+51
-14
lines changed

2 files changed

+51
-14
lines changed

core/src/components/modal/modal.ionic.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
:host {
88
--backdrop-opacity: 1;
9+
--background: globals.$ionic-base-color-white;
10+
--box-shadow: globals.$ionic-elevation-300;
11+
12+
color: globals.$ionic-color-neutral-1200;
913
}
1014

1115
// Shape
@@ -21,3 +25,20 @@
2125
:host(.modal-rectangular) {
2226
--border-radius: #{globals.$ionic-border-radius-0};
2327
}
28+
29+
// Sheet Modal
30+
// --------------------------------------------------
31+
32+
.modal-handle {
33+
@include globals.position(globals.$ionic-space-300, 0px, null, 0px);
34+
@include globals.border-radius(globals.$ionic-border-radius-100);
35+
36+
width: globals.$ionic-scale-1100;
37+
height: globals.$ionic-scale-100;
38+
39+
background-color: globals.$ionic-color-neutral-300;
40+
}
41+
42+
:host(.modal-sheet) .modal-wrapper {
43+
@include globals.border-radius(var(--border-radius), var(--border-radius), 0, 0);
44+
}

core/src/css/ionic/core.ionic.scss

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,45 +36,61 @@ body.backdrop-no-scroll {
3636

3737
// Modal - Card Style
3838
// --------------------------------------------------
39+
html.ionic ion-modal.modal-sheet ion-header {
40+
box-shadow: none;
41+
}
42+
3943
/**
40-
* Card style modal needs additional padding on the
44+
* Modals need additional padding on the
4145
* top of the header. We accomplish this by targeting
4246
* the first toolbar in the header.
4347
* Footer also needs this. We do not adjust the bottom
4448
* padding though because of the safe area.
4549
*/
46-
html.ios ion-modal.modal-card ion-header ion-toolbar:first-of-type,
47-
html.ios ion-modal.modal-sheet ion-header ion-toolbar:first-of-type,
48-
html.ios ion-modal ion-footer ion-toolbar:first-of-type {
49-
padding-top: globals.$ionic-space-150;
50+
html.ionic ion-modal.modal-card ion-header ion-toolbar:first-of-type,
51+
html.ionic ion-modal.modal-sheet ion-header ion-toolbar:first-of-type,
52+
html.ionic ion-modal ion-footer ion-toolbar:first-of-type {
53+
padding-top: globals.$ionic-space-400;
5054
}
5155

5256
/**
53-
* Card style modal needs additional padding on the
57+
* Modals need additional padding on the
5458
* bottom of the header. We accomplish this by targeting
5559
* the last toolbar in the header.
5660
*/
57-
html.ios ion-modal.modal-card ion-header ion-toolbar:last-of-type,
58-
html.ios ion-modal.modal-sheet ion-header ion-toolbar:last-of-type {
59-
padding-bottom: globals.$ionic-space-150;
61+
html.ionic ion-modal.modal-card ion-header ion-toolbar:last-of-type,
62+
html.ionic ion-modal.modal-sheet ion-header ion-toolbar:last-of-type,
63+
html.ionic ion-modal ion-footer ion-toolbar:last-of-type {
64+
padding-bottom: globals.$ionic-space-400;
6065
}
6166

6267
/**
6368
* Add padding on the left and right
6469
* of toolbars while accounting for
6570
* safe area values when in landscape.
6671
*/
67-
html.ios ion-modal ion-toolbar {
68-
padding-right: calc(var(--ion-safe-area-right) + globals.$ionic-space-200);
69-
padding-left: calc(var(--ion-safe-area-left) + globals.$ionic-space-200);
72+
html.ionic ion-modal ion-toolbar {
73+
padding-right: calc(var(--ion-safe-area-right) + globals.$ionic-space-400);
74+
padding-left: calc(var(--ion-safe-area-left) + globals.$ionic-space-400);
75+
}
76+
77+
/**
78+
* Add padding to the left, right, and bottom of `ion-content`
79+
* within a modal.
80+
*/
81+
html.ionic ion-modal.modal-sheet ion-content {
82+
--padding-start: #{globals.$ionic-space-400};
83+
--padding-end: #{globals.$ionic-space-400};
84+
--padding-bottom: #{globals.$ionic-space-400};
85+
--background: #{globals.$ionic-color-base-white};
7086
}
7187

7288
/**
7389
* Card style modal on iPadOS
7490
* should only have backdrop on first instance.
7591
*/
7692
@media screen and (min-width: 768px) {
77-
html.ios ion-modal.modal-card:first-of-type {
93+
html.ionic ion-modal.modal-card:first-of-type {
7894
--backdrop-opacity: 0.18;
7995
}
8096
}
@@ -121,7 +137,7 @@ ion-modal.modal-default.show-modal ~ ion-modal.modal-default {
121137
* radius no matter the platform.
122138
* This behavior only applies to card modals.
123139
*/
124-
html.ios ion-modal.modal-card .ion-page {
140+
html.ionic ion-modal.modal-card .ion-page {
125141
border-top-left-radius: var(--border-radius);
126142
}
127143

0 commit comments

Comments
 (0)