Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/routes/_components/ModalSelectProject.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
export let projects

$: project = $page.url.searchParams.get('project')
let isActive = false

/** @type {HTMLDialogElement} */
let dialog

/**
* @param {string} sid
Expand All @@ -26,17 +28,17 @@
}

export function open () {
isActive = true
dialog.showModal()
}

function close () {
isActive = false
dialog.close()
}
</script>

<div class="nm-modal" on:click|self={close} class:is-active={isActive} aria-hidden="true">
<div class="nm-modal-panel">
<div class="nm-modal-close" on:click|self={close} on:keypress={close} tabindex="0" role="button">✕</div>
<dialog bind:this={dialog} on:click|self={close} aria-hidden="true">
<div class="panel">
<div class="close" on:click|self={close} on:keypress={close}>✕</div>
<h4>Projects</h4>

<div class="nm-table-container _mgt-6">
Expand All @@ -58,7 +60,6 @@
</td>
<td>
<div on:click={() => setProject(it.project)} on:keypress={() => setProject(it.project)}
tabindex="0" role="link"
class="_tdcrt-udl _cs-pt _cl-primary:hover"
style="font-weight: 500">
{it.name}
Expand All @@ -71,7 +72,7 @@
</table>
</div>
</div>
</div>
</dialog>

<style lang="scss">
.nm-table-container {
Expand All @@ -84,7 +85,7 @@
padding-bottom: 0.5rem;
}

.nm-modal-panel {
.panel {
box-shadow: 0 15px 15px 0 rgba(43, 43, 43, 0.1);
width: 100%;
max-width: 48rem;
Expand Down
4 changes: 2 additions & 2 deletions src/style/_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
0 4rem 4rem hsl(var(--bsd-hsl) / 0.15);
}

[data-theme=dark] {
[data-theme=dark], ::backdrop {
--lo-container-side-padding: 24px;
--lo-page-aside-content--aside-width: 18.75rem;
--form-element-small-font-size: 0.75rem;
Expand Down Expand Up @@ -183,7 +183,7 @@
--modal-panel-background: hsl(var(--hsl-base-300));
}

[data-theme=light] {
[data-theme=light], ::backdrop {
--hue-primary: 333;
--hsl-primary: var(--hue-primary) 80% 65%;
--hsl-primary-active: var(--hue-primary) 80% 58%;
Expand Down
53 changes: 53 additions & 0 deletions src/style/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,56 @@ pre {
overflow-y: auto;
}
}

dialog {
padding: 0;
background: transparent;
border: 0;
color: inherit;

&::backdrop {
background: var(--modal-background);
}

.panel {
position: relative;
width: 100%;
margin-top: 1rem;
max-width: 48rem;
padding: 1.5rem;
-webkit-transition: all .16s ease-in-out;
transition: all .16s ease-in-out;
-webkit-transform: translate3d(0, -12px, 0);
transform: translate3d(0, -12px, 0);
border-radius: 0.75rem;
background: var(--modal-panel-background, hsl(var(--hsl-base-100)));
-webkit-box-shadow: var(--box-shadow-200);
box-shadow: var(--box-shadow-200);
}

.close {
font-weight: 600;
position: absolute;
top: .5rem;
right: .5rem;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
width: 2.5rem;
height: 2.5rem;
cursor: pointer;
color: hsl(var(--hsl-content)/0.7);
border-radius: 0.5rem;
background: hsl(var(--hsl-base-300)/0.5);

&:hover {
background: hsl(var(--hsl-base-300)/0.8);
}
}
}