diff --git a/src/components/modal/modal.scss b/src/components/modal/modal.scss index e5ade1ea54f..f8af3e16ed3 100644 --- a/src/components/modal/modal.scss +++ b/src/components/modal/modal.scss @@ -20,6 +20,11 @@ --calcite-modal-scrim-background-internal: #{rgba($blk-240, 0.85)}; } +.content-top[hidden], +.content-bottom[hidden] { + @apply hidden; +} + .container { @apply text-color-2 fixed @@ -184,12 +189,31 @@ */ .content { @apply relative box-border block h-full overflow-auto p-0; - max-block-size: 100%; background-color: var(--calcite-modal-content-background, theme("colors.background.foreground.1")); - padding-block: var(--calcite-modal-content-padding, var(--calcite-modal-padding-internal)); - padding-inline: var(--calcite-modal-content-padding, var(--calcite-modal-padding-internal)); + max-block-size: 100%; + padding: var(--calcite-modal-content-padding, var(--calcite-modal-padding-internal)); +} + +.content-top, +.content-bottom { + @apply bg-foreground-1 border-color-3 border-solid border-0 z-header flex; + flex: 0 0 auto; + padding: var(--calcite-modal-padding-internal); } +.content-top { + @apply min-w-0 max-w-full border-b; +} + +.content-bottom { + @apply mt-auto box-border w-full justify-between border-t; +} + +.content-top:not(.header ~ .content-top) { + @apply rounded-t; +} + +.content-bottom:not(.content-bottom ~ .footer), .content--no-footer { @apply rounded-b; } @@ -287,10 +311,10 @@ slot[name="primary"] { } :host([open][fullscreen]) { - .header { - border-radius: 0; - } - .footer { + .header, + .footer, + .content-top, + .content-bottom { border-radius: 0; } } @@ -339,7 +363,8 @@ slot[name="primary"] { .modal { @apply border-0 border-t-4 border-solid; } - .header { + .header, + .content-top { @apply rounded rounded-b-none; } } @@ -348,10 +373,11 @@ slot[name="primary"] { * Tablet */ @media screen and (max-width: $viewport-medium) { - @include slotted("header", "*") { + @include slotted("header", "content-top", "*") { @apply text-1; } - .footer { + .footer, + .content-bottom { @apply sticky bottom-0; } } @@ -360,7 +386,8 @@ slot[name="primary"] { * Mobile */ @media screen and (max-width: $viewport-small) { - .footer { + .footer, + .content-bottom { @apply flex-col; } .back, diff --git a/src/components/modal/modal.stories.ts b/src/components/modal/modal.stories.ts index 2ab050d4573..ab474c92345 100644 --- a/src/components/modal/modal.stories.ts +++ b/src/components/modal/modal.stories.ts @@ -27,7 +27,7 @@ export const simple = (): string => html` >
The small modal is perfect for short confirmation dialogs or very compact interfaces with few elements.
+ The small modal is perfect for short confirmation dialogs or very compact interfaces with few elements.