Skip to content

Commit 64a4ffe

Browse files
committed
feat(select-modal): add ionic select default modal styling
1 parent fe18f99 commit 64a4ffe

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
--border-radius: #{globals.$ion-border-radius-0};
2828
}
2929

30+
// Default Modal
31+
// --------------------------------------------------
32+
33+
// Modal when inside a select default-modal
34+
:host(.select-modal.modal-default) {
35+
--max-height: 45%;
36+
--max-width: calc(100% - (#{globals.$ion-space-400} * 2));
37+
--min-height: 340px;
38+
}
39+
3040
// Sheet Modal
3141
// --------------------------------------------------
3242

@@ -54,4 +64,4 @@
5464
*/
5565
:host(.modal-sheet) {
5666
--height: calc(100% - (var(--ion-safe-area-top) + #{globals.$ion-scale-250}));
57-
}
67+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
// Ionic Select Modal
55
// --------------------------------------------------
66

7+
:host(.in-modal-default) ion-content::part(scroll) {
8+
--padding-bottom: #{globals.$ion-space-400};
9+
}
10+
711
// Item
812
// ----------------------------------------------------------------
913

core/src/components/select-modal/select-modal.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getIonMode } from '@global/ionic-global';
22
import type { ComponentInterface } from '@stencil/core';
33
import { Component, Element, Host, Prop, forceUpdate, h } from '@stencil/core';
44
import { safeCall } from '@utils/overlays';
5-
import { getClassMap } from '@utils/theme';
5+
import { getClassMap, hostContext } from '@utils/theme';
66

77
import type { CheckboxCustomEvent } from '../checkbox/checkbox-interface';
88
import type { RadioGroupCustomEvent } from '../radio-group/radio-group-interface';
@@ -74,6 +74,14 @@ export class SelectModal implements ComponentInterface {
7474
}
7575
}
7676

77+
private getModalContextClasses() {
78+
const el = this.el;
79+
return {
80+
'in-modal-default': hostContext('ion-modal.modal-default', el),
81+
'in-modalsheet': hostContext('ion-modal.modal-sheet', el),
82+
};
83+
}
84+
7785
private renderRadioOptions() {
7886
const checked = this.options.filter((o) => o.checked).map((o) => o.value)[0];
7987

@@ -143,7 +151,10 @@ export class SelectModal implements ComponentInterface {
143151

144152
render() {
145153
return (
146-
<Host class={getIonMode(this)}>
154+
<Host class={{
155+
[getIonMode(this)]: true,
156+
...this.getModalContextClasses(),
157+
}}>
147158
<ion-header>
148159
<ion-toolbar>
149160
{this.header !== undefined && <ion-title>{this.header}</ion-title>}

0 commit comments

Comments
 (0)