✨(react) add Modal
Here it is! Our really wanted Modal component, based on Figma sketches.
This commit is contained in:
139
packages/react/src/components/Modal/index.scss
Normal file
139
packages/react/src/components/Modal/index.scss
Normal file
@@ -0,0 +1,139 @@
|
||||
@use "../../utils/responsive" as *;
|
||||
|
||||
.c__modal {
|
||||
padding: 1.5rem;
|
||||
background-color: var(--c--components--modal--background-color);
|
||||
border-radius: var(--c--components--modal--border-radius);
|
||||
border-color: var(--c--components--modal--border-color);
|
||||
box-shadow: var(--c--components--modal--box-shadow);
|
||||
color: var(--c--components--modal--color);
|
||||
box-sizing: border-box;
|
||||
|
||||
&::backdrop {
|
||||
// ::backdrop does not inherit from its element so CSS vars does not work.
|
||||
// ( https://stackoverflow.com/a/77393321 ) So we need to use the color directly.
|
||||
// In the future we will maybe be able to use the following:
|
||||
// background: var(--c--components--modal--backdrop-color);
|
||||
background: #0C1A2B99;
|
||||
}
|
||||
|
||||
&__title {
|
||||
--font-size: var(--c--theme--font--sizes--h2);
|
||||
margin-bottom: 1.5rem;
|
||||
font-size: var(--font-size);
|
||||
font-weight: var(--c--components--modal--title-font-weight);
|
||||
text-align: center;
|
||||
// To avoid any collision with the close button.
|
||||
padding: 0 0.75rem;
|
||||
}
|
||||
|
||||
&__title-icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 1.5rem;
|
||||
--icon-size: 2rem;
|
||||
|
||||
* {
|
||||
font-size: var(--icon-size);
|
||||
}
|
||||
}
|
||||
|
||||
&__content {
|
||||
text-align: center;
|
||||
font-size: var(--c--components--modal--content-font-size);
|
||||
font-weight: var(--c--components--modal--content-font-weight);
|
||||
color: var(--c--components--modal--content-color);
|
||||
}
|
||||
|
||||
&__close {
|
||||
position: absolute;
|
||||
top: 0.75rem;
|
||||
right: 0.75rem;
|
||||
}
|
||||
|
||||
&__footer {
|
||||
margin-top: 1.5rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
background-color: var(--c--components--modal--background-color);
|
||||
|
||||
&--sided {
|
||||
justify-content: space-between;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
&__left, &__right {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
&--small {
|
||||
width: var(--c--components--modal--width-small);
|
||||
|
||||
@include media(sm) {
|
||||
width: calc(100vw - 1rem);
|
||||
}
|
||||
|
||||
.c__modal__title-icon {
|
||||
--icon-size: 3rem;
|
||||
}
|
||||
}
|
||||
|
||||
&--medium {
|
||||
width: var(--c--components--modal--width-medium);
|
||||
|
||||
@include media(sm) {
|
||||
width: calc(100vw - 1rem);
|
||||
}
|
||||
|
||||
.c__modal__title-icon {
|
||||
--icon-size: 4rem;
|
||||
}
|
||||
}
|
||||
|
||||
&--large {
|
||||
width: var(--c--components--modal--width-large);
|
||||
|
||||
@include media(md) {
|
||||
width: calc(100vw - 1rem);
|
||||
}
|
||||
|
||||
.c__modal__title {
|
||||
--font-size: var(--c--theme--font--sizes--h1);
|
||||
}
|
||||
|
||||
.c__modal__title-icon {
|
||||
--icon-size: 6rem;
|
||||
}
|
||||
}
|
||||
|
||||
&--full {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
margin: 0;
|
||||
width: auto;
|
||||
height: 100vh;
|
||||
max-width: none;
|
||||
max-height: 100vh;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.c__modal__content {
|
||||
flex-grow: 1;
|
||||
overflow-y:scroll;
|
||||
}
|
||||
|
||||
.c__modal__title {
|
||||
--font-size: var(--c--theme--font--sizes--h1);
|
||||
}
|
||||
|
||||
.c__modal__title-icon {
|
||||
--icon-size: 6rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user