-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow re-opening completed and dead-end modals (#131)
- Loading branch information
Showing
8 changed files
with
140 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script lang="ts"> | ||
import { icons, type IIconName } from "./icons"; | ||
export let icon: IIconName; | ||
</script> | ||
|
||
<svg viewBox="0 0 16 16"> | ||
<path | ||
fill="none" | ||
stroke="currentColor" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="1" | ||
d={icons[icon].path} | ||
/> | ||
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export type IIconName = | ||
| "Close" | ||
| "Help" | ||
| "Menu" | ||
| "Minimize" | ||
| "OpenModal" | ||
| "Shuffle" | ||
| "Undo"; | ||
export const icons: { [key in IIconName]: { path: string } } = { | ||
Close: { | ||
path: "M 3 3 L 13 13 M 3 13 L 13 3", | ||
}, | ||
Help: { | ||
path: "M 8 12 L 8 12 M 8 10 L 8 9 C 8 7 10 8 10 6 A 2 2 0 1 0 6 6 M 8 1.5 A 6.5 6.5 0 0 1 8 14.5 A 6.5 6.5 0 0 1 8 1.5", | ||
}, | ||
Menu: { | ||
path: "M 2 4 L 14 4 M 2 8 L 14 8 M 2 12 L 14 12", | ||
}, | ||
Minimize: { | ||
path: "M 11 13 L 6.75 13 M 11 11 L 6.75 11 M 11 11 L 11 6.75 M 11 11 L 3 3", | ||
}, | ||
OpenModal: { | ||
path: "M 3 3 L 7.25 3 M 3 3 L 3 7.25 M 3 3 L 10 10 M 3 11 A 2 2 0 0 0 5 13 L 11 13 A 2 2 0 0 0 13 11 L 13 5 A 2 2 0 0 0 11 3 L 11 3", | ||
}, | ||
Shuffle: { | ||
path: "M 5 2 L 2 5 L 5 8 M 2 5 L 12 5 M 11 14 L 14 11 L 11 8 M 14 11 L 4 11", | ||
}, | ||
Undo: { | ||
path: "M 5 3 L 2 6 L 5 9 M 2 6 L 10 6 A 3 3 0 1 1 10 13 L 8 13", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<script lang="ts"> | ||
import Icon from "./Menu/Icon.svelte"; | ||
import Modal from "./Modal.svelte"; | ||
export let title: string; | ||
export let position: "left" | "center" = "center"; | ||
let open = true; | ||
const onClose = () => { | ||
setTimeout(() => (open = false), 25); | ||
}; | ||
const onOpen = () => { | ||
open = true; | ||
}; | ||
</script> | ||
|
||
{#if open} | ||
<Modal {title} {position} closeIcon="Minimize" on:close={onClose}> | ||
<slot /> | ||
</Modal> | ||
{/if} | ||
<button class="minimized-modal {open ? '' : 'open'}" on:click={onOpen}> | ||
<Icon icon="OpenModal" /> | ||
<span class="title">{title}</span> | ||
</button> | ||
|
||
<style lang="sass"> | ||
.minimized-modal | ||
position: fixed | ||
bottom: -1rem | ||
right: 1.5rem | ||
z-index: 2 | ||
appearance: none | ||
background: white | ||
border: 0px none | ||
border-radius: 0.25em | ||
cursor: pointer | ||
padding: 0.33em 0.66em 1.33rem 0.5em | ||
display: flex | ||
align-items: center | ||
gap: 0.25em | ||
font-size: 1rem | ||
box-shadow: 0 0 1rem rgba(0, 0, 0, 0.75) | ||
transition: transform 100ms, box-shadow 100ms | ||
transform: translateY(110%) | ||
&.open | ||
transform: translateY(0) | ||
&:hover | ||
transform: translateY(-0.15rem) | ||
&:active | ||
box-shadow: 0 -0.25rem 1rem rgba(0, 0, 0, 0.75) | ||
transform: translateY(0.1rem) | ||
&:focus-visible | ||
outline: 4px solid black | ||
outline-offset: 4px | ||
:global(svg) | ||
height: 1.5em | ||
vertical-align: top | ||
margin-right: 0.25em | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters