kithkin/resources/css/lib/modal.css

144 lines
3.2 KiB
CSS

.close-modal {
@apply hidden;
}
dialog {
@apply grid fixed inset-0 m-0 p-0 pointer-events-none;
@apply place-items-center bg-transparent opacity-0 invisible;
@apply w-full h-full max-w-none max-h-none overflow-clip;
background-color: rgba(26, 26, 26, 0.75);
backdrop-filter: blur(0.25rem);
/*(grid-template-rows: minmax(20dvh, 2rem) 1fr; */
overscroll-behavior: contain;
scrollbar-gutter: auto;
transition:
background-color 150ms cubic-bezier(0,0,.2,1),
opacity 150ms cubic-bezier(0,0,.2,1),
visibility 150ms cubic-bezier(0,0,.2,1);
z-index: 100;
#modal {
@apply relative rounded-xl bg-white border-gray-200 p-0;
@apply flex flex-col items-start col-start-1 translate-y-4;
@apply overscroll-contain overflow-y-auto;
max-height: calc(100dvh - 5rem);
width: 91.666667%;
max-width: 36rem;
transition: translate 150ms cubic-bezier(0,0,.2,1);
box-shadow: 0 1.5rem 4rem -0.5rem rgba(0, 0, 0, 0.4);
> .close-modal {
@apply block absolute top-4 right-4 z-3;
}
> .content {
@apply w-full;
/* modal header */
header {
@apply sticky top-0 bg-white flex items-center px-6 h-20 z-2;
h2 {
@apply pr-12;
}
}
/* main content pane */
section {
@apply flex flex-col px-6 pb-8;
}
/* standard form with 1rem gap between rows */
form {
@apply flex flex-col gap-4;
}
/* footer */
footer {
@apply sticky bottom-0 bg-white px-6 py-4 border-t-md border-gray-400 flex justify-between;
}
/* event modal with a map */
&.with-map {
header {
background: linear-gradient(180deg,rgba(255, 255, 255, 0.67) 0%, rgba(255, 255, 255, 0) 100%);
}
}
}
}
&::backdrop {
display: none;
}
&[open] {
@apply opacity-100 visible;
pointer-events: inherit;
#modal {
@apply translate-y-0;
}
&::backdrop {
@apply opacity-100;
}
}
}
/**
* tabs using <details> and <summary>
*/
dialog:has(.modal-tabs) {
@apply items-start justify-items-center;
#modal {
@apply relative;
max-height: 85dvh;
max-width: 48rem;
top: 10dvh;
}
form.modal {
@apply !block;
}
}
.modal-tab {
> summary {
@apply sticky left-6 w-32 flex flex-row gap-2;
top: 6rem;
&::before {
@apply bg-gray-10;
}
&::after {
@apply hidden;
}
}
&:nth-of-type(2) {
> summary { top: 8.75rem; }
}
&:nth-of-type(3) {
> summary { top: 11.5rem; }
}
&:nth-of-type(4) {
> summary { top: 14.25rem; }
}
&:nth-of-type(5) {
> summary { top: 17rem; }
}
&[open] {
> summary::before {
@apply bg-gray-100;
}
}
div.tab-content {
@apply flex flex-col gap-4 pl-40 pt-4 min-h-48;
}
}