-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v2' into feat-skeleton-loader
# Conflicts: # v2/pink-sb/src/lib/Skeleton.svelte
- Loading branch information
Showing
9 changed files
with
196 additions
and
55 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
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,125 @@ | ||
<script lang="ts"> | ||
import Title from '$lib/typography/Title.svelte'; | ||
import Button from '$lib/button/Button.svelte'; | ||
import Stack from '$lib/layout/Stack.svelte'; | ||
import { IconX } from '@appwrite.io/pink-icons-svelte'; | ||
import Icon from './Icon.svelte'; | ||
export let title: string; | ||
export let description = ''; | ||
export let open = false; | ||
let dialog: HTMLDialogElement; | ||
function handleBLur(event: MouseEvent) { | ||
if (event.target === dialog) { | ||
dialog.close(); | ||
} | ||
} | ||
function handleKeydown(event: KeyboardEvent) { | ||
if (event.key === 'Escape') { | ||
event.preventDefault(); | ||
dialog.close(); | ||
} | ||
} | ||
$: if (dialog) { | ||
if (open) { | ||
dialog.showModal(); | ||
} else { | ||
dialog.close(); | ||
} | ||
} | ||
</script> | ||
|
||
<svelte:window on:mousedown={handleBLur} on:keydown={handleKeydown} /> | ||
|
||
<dialog bind:this={dialog} on:close={() => (open = false)}> | ||
<section> | ||
{#if open} | ||
<header> | ||
<Stack gap="xl" justifyContent="space-between" direction="row" alignItems="center"> | ||
<Title size="s">{title}</Title> | ||
<Button icon variant="ghost" size="s" on:click={() => (open = false)}> | ||
<Icon icon={IconX} /> | ||
</Button> | ||
</Stack> | ||
{#if description} | ||
<p>{description}</p> | ||
{/if} | ||
</header> | ||
<div class="content"> | ||
<Stack gap="xl"> | ||
<slot /> | ||
</Stack> | ||
</div> | ||
<footer> | ||
<slot name="footer"> | ||
<Stack direction="row" gap="s" justifyContent="flex-end"> | ||
<Button variant="text" size="s" on:click={() => (open = false)}> | ||
Cancel | ||
</Button> | ||
<Button on:click size="s">Save</Button> | ||
</Stack> | ||
</slot> | ||
</footer> | ||
{/if} | ||
</section> | ||
</dialog> | ||
|
||
<style lang="scss"> | ||
dialog { | ||
padding: 0; | ||
border: none; | ||
background: none; | ||
overflow: visible; | ||
section { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
overflow: hidden; | ||
width: 600px; | ||
border-radius: var(--border-radius-l); | ||
border: var(--border-width-s) solid var(--color-border-neutral); | ||
background: var(--color-bgcolor-neutral-primary); | ||
color: var(--color-fgcolor-neutral-primary); | ||
/* box-shadow/neutral/XL */ | ||
box-shadow: | ||
0px 56px 32px 0px rgba(0, 0, 0, 0.02), | ||
0px 6px 14px 0px rgba(0, 0, 0, 0.04), | ||
0px 24px 25px 0px rgba(0, 0, 0, 0.03); | ||
header, | ||
footer { | ||
display: flex; | ||
width: 100%; | ||
padding: var(--space-8); | ||
flex-direction: column; | ||
align-items: flex-start; | ||
gap: var(--gap-xxs); | ||
border-top: var(--border-width-s) solid var(--color-border-neutral); | ||
} | ||
header { | ||
border-bottom: var(--border-width-s) solid var(--color-border-neutral); | ||
background: var(--color-bgcolor-neutral-primary); | ||
p { | ||
color: var(--color-fgcolor-neutral-secondary); | ||
font-family: var(--font-family-sansserif); | ||
font-size: var(--font-size-s); | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 140%; /* 19.6px */ | ||
letter-spacing: -0.063px; | ||
} | ||
} | ||
.content { | ||
width: 100%; | ||
padding: var(--space-8); | ||
} | ||
} | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<script context="module" lang="ts"> | ||
import Modal from '$lib/Modal.svelte'; | ||
import type { MetaProps } from '@storybook/addon-svelte-csf'; | ||
export const meta: MetaProps = { | ||
title: 'Components/Modal', | ||
component: Modal, | ||
args: { | ||
title: 'Modal Title', | ||
description: 'This is a Modal description title.' | ||
} | ||
}; | ||
</script> | ||
|
||
<script> | ||
import { Button } from '$lib/button/index.js'; | ||
import Text from '$lib/input/Text.svelte'; | ||
import { Story } from '@storybook/addon-svelte-csf'; | ||
let open = false; | ||
</script> | ||
|
||
<Story name="Default" let:args> | ||
<Modal {...args} bind:open> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Numquam molestiae voluptatem | ||
alias omnis quod. | ||
</p> | ||
<Text placeholder="Type something here" /> | ||
</Modal> | ||
<Button on:click={() => (open = !open)}>Open Modal</Button> | ||
</Story> |
This file was deleted.
Oops, something went wrong.
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