Skip to content

Commit ff08d39

Browse files
author
Tanner Reits
committed
feat(modal): split common & native styles
1 parent 0f4d733 commit ff08d39

File tree

6 files changed

+61
-43
lines changed

6 files changed

+61
-43
lines changed

core/src/components/modal/modal.scss renamed to core/src/components/modal/modal.common.scss

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
@import "./modal.vars";
1+
@import "../../themes/native/native.globals";
22

3-
// Modals
3+
// Modals: Common Styles
44
// --------------------------------------------------
55

66
:host {
77
/**
8-
* @prop --background: Background of the modal content
9-
*
108
* @prop --border-color: Border color of the modal content
11-
* @prop --border-radius: Border radius of the modal content
129
* @prop --border-width: Border width of the modal content
1310
* @prop --border-style: Border style of the modal content
1411
*
@@ -19,8 +16,6 @@
1916
* @prop --min-height: Minimum height of the modal
2017
* @prop --height: Height of the modal
2118
* @prop --max-height: Maximum height of the modal
22-
*
23-
* @prop --backdrop-opacity: Opacity of the backdrop
2419
*/
2520
--width: 100%;
2621
--min-width: auto;
@@ -29,13 +24,10 @@
2924
--min-height: auto;
3025
--max-height: auto;
3126
--overflow: hidden;
32-
--border-radius: 0;
3327
--border-width: 0;
3428
--border-style: none;
3529
--border-color: transparent;
36-
--background: #{$background-color};
3730
--box-shadow: none;
38-
--backdrop-opacity: 0;
3931

4032
@include position(0, 0, 0, 0);
4133

@@ -47,8 +39,6 @@
4739

4840
outline: none;
4941

50-
color: $modal-text-color;
51-
5242
contain: strict;
5343
}
5444

@@ -90,37 +80,14 @@ ion-backdrop {
9080
background: transparent;
9181
}
9282

93-
@media only screen and (min-width: $modal-inset-min-width) and (min-height: $modal-inset-min-height-small) {
94-
:host {
95-
--width: #{$modal-inset-width};
96-
--height: #{$modal-inset-height-small};
97-
--ion-safe-area-top: 0px;
98-
--ion-safe-area-bottom: 0px;
99-
--ion-safe-area-right: 0px;
100-
--ion-safe-area-left: 0px;
101-
}
102-
}
103-
104-
@media only screen and (min-width: $modal-inset-min-width) and (min-height: $modal-inset-min-height-large) {
105-
:host {
106-
--width: #{$modal-inset-width};
107-
--height: #{$modal-inset-height-large};
108-
}
109-
}
110-
11183
// Sheet Modal
11284
// --------------------------------------------------
11385

11486
.modal-handle {
115-
@include position(5px, 0px, null, 0px);
116-
@include border-radius(8px, 8px, 8px, 8px);
11787
@include margin(null, auto, null, auto);
11888

11989
position: absolute;
12090

121-
width: 36px;
122-
height: 5px;
123-
12491
/**
12592
* This allows the handle to appear
12693
* on top of user content in WebKit.
@@ -129,8 +96,6 @@ ion-backdrop {
12996

13097
border: 0;
13198

132-
background: var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));
133-
13499
cursor: pointer;
135100

136101
z-index: 11;
@@ -144,9 +109,6 @@ ion-backdrop {
144109

145110
position: absolute;
146111

147-
width: 36px;
148-
height: 5px;
149-
150112
transform: translate(-50%, -50%);
151113

152114
content: "";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@use "../../themes/ionic/ionic.globals.scss" as globals;
2-
@import "./modal";
2+
@import "./modal.common";
33

44
// Ionic Modal
55
// --------------------------------------------------

core/src/components/modal/modal.ios.scss

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

44
// iOS Modals

core/src/components/modal/modal.md.scss

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

44
// Material Design Modals
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
@use "./datetime.common";
2+
@import "./modal.native.vars";
3+
4+
// Modals: Native Styles
5+
// --------------------------------------------------
6+
7+
:host {
8+
/**
9+
* @prop --background: Background of the modal content
10+
*
11+
* @prop --border-radius: Border radius of the modal content
12+
*
13+
* @prop --backdrop-opacity: Opacity of the backdrop
14+
*/
15+
--background: #{$background-color};
16+
--border-radius: 0;
17+
--backdrop-opacity: 0;
18+
19+
color: $modal-text-color;
20+
}
21+
22+
@media only screen and (min-width: $modal-inset-min-width) and (min-height: $modal-inset-min-height-small) {
23+
:host {
24+
--width: #{$modal-inset-width};
25+
--height: #{$modal-inset-height-small};
26+
--ion-safe-area-top: 0px;
27+
--ion-safe-area-bottom: 0px;
28+
--ion-safe-area-right: 0px;
29+
--ion-safe-area-left: 0px;
30+
}
31+
}
32+
33+
@media only screen and (min-width: $modal-inset-min-width) and (min-height: $modal-inset-min-height-large) {
34+
:host {
35+
--width: #{$modal-inset-width};
36+
--height: #{$modal-inset-height-large};
37+
}
38+
}
39+
40+
// Sheet Modal
41+
// --------------------------------------------------
42+
43+
.modal-handle {
44+
@include position(5px, 0px, null, 0px);
45+
@include border-radius(8px, 8px, 8px, 8px);
46+
47+
width: 36px;
48+
height: 5px;
49+
50+
background: var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));
51+
52+
&::before {
53+
width: 36px;
54+
height: 5px;
55+
}
56+
}

0 commit comments

Comments
 (0)