-
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.
1-small ui adjustments like using mutedColor in loading components.
2-adding the alert component with two variants inline and dialog
- Loading branch information
1 parent
6e556fb
commit eb3e575
Showing
23 changed files
with
266 additions
and
33 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
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
13 changes: 13 additions & 0 deletions
13
apps/docs/src/lib/components/zeroUIWrappers/dialogAlert.svelte
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,13 @@ | ||
<script> | ||
import { SyncButton, DialogAlert } from 'zero-ui-registry'; | ||
</script> | ||
|
||
<DialogAlert | ||
type="danger" | ||
header="Are you sure?" | ||
description="This action can't be undone.This will permanently erase all of your date be sure to backup your files." | ||
> | ||
<svelte:fragment slot="alertTrigger" let:open> | ||
<SyncButton text="Delete" on:click={() => open()} type="danger" /> | ||
</svelte:fragment> | ||
</DialogAlert> |
9 changes: 9 additions & 0 deletions
9
apps/docs/src/lib/components/zeroUIWrappers/inlineAlert.svelte
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,9 @@ | ||
<script> | ||
import { InlineAlert } from 'zero-ui-registry'; | ||
</script> | ||
|
||
<InlineAlert | ||
description="The operation was completed successfully" | ||
header="Operation status" | ||
type="success" | ||
/> |
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 @@ | ||
### TODO |
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 @@ | ||
### TODO |
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,93 @@ | ||
<script> | ||
import DefaultDialog from "../dialog/defaultDialog.svelte"; | ||
import { scale } from "svelte/transition"; | ||
import { quadInOut } from "svelte/easing"; | ||
import SyncButton from "../button/syncButton.svelte"; | ||
import { createEventDispatcher } from "svelte"; | ||
/**@type {string}*/ | ||
export let header; | ||
/**@type {string}*/ | ||
export let description; | ||
/**@type {"primary"|"danger"}*/ | ||
export let type = "primary"; | ||
const dispatcher = createEventDispatcher(); | ||
</script> | ||
|
||
<DefaultDialog let:close> | ||
<svelte:fragment slot="trigger" let:open> | ||
<slot name="alertTrigger" {open} /> | ||
</svelte:fragment> | ||
<div | ||
class="dialogAlert {type}" | ||
transition:scale={{ | ||
duration: 520, | ||
easing: quadInOut, | ||
start: 0, | ||
opacity: 0.2, | ||
}} | ||
> | ||
<h4>{header}</h4> | ||
<p>{description}</p> | ||
<div class="controls"> | ||
<SyncButton | ||
text="Cancel" | ||
type="passive" | ||
on:click={() => { | ||
dispatcher("cancel"); | ||
close(); | ||
}} | ||
/> | ||
<SyncButton | ||
text="Confirm" | ||
{type} | ||
on:click={() => { | ||
dispatcher("confirm"); | ||
close(); | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
</DefaultDialog> | ||
|
||
<style> | ||
.primary { | ||
--main-color: var(--primaryColor); | ||
} | ||
.danger { | ||
--main-color: var(--dangerColor); | ||
} | ||
.dialogAlert { | ||
width: 45vw; | ||
display: flex; | ||
flex-direction: column; | ||
background-color: var(--backgroundColor); | ||
border: 2px solid var(--main-color); | ||
border-radius: var(--border-radius); | ||
gap: 1rem; | ||
padding: 1.25rem; | ||
} | ||
.dialogAlert h4 { | ||
display: inline-block; | ||
font-size: var(--h4); | ||
font-weight: 600; | ||
font-family: var(--headerFont); | ||
color: var(--foregroundColor); | ||
} | ||
.dialogAlert p { | ||
font-size: var(--small); | ||
font-family: var(--bodyFont); | ||
color: var(--mutedColor); | ||
} | ||
.controls { | ||
display: flex; | ||
align-items: center; | ||
align-self: flex-end; | ||
gap: 0.5rem; | ||
} | ||
@media screen and (width<768px) { | ||
.dialogAlert { | ||
width: 95vw; | ||
} | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<script> | ||
import InfoIcon from "../../icons/infoIcon.svelte"; | ||
import DangerIcon from "../../icons/dangerIcon.svelte"; | ||
import SuccessIcon from "../../icons/successIcon.svelte"; | ||
/**@type {string}*/ | ||
export let header; | ||
/**@type {string}*/ | ||
export let description; | ||
/**@type {"primary"|"success"|"danger"}*/ | ||
export let type = "primary"; | ||
/**@type {import("../../types").iconComponent}*/ | ||
export let icon = | ||
type == "primary" ? InfoIcon : type == "danger" ? DangerIcon : SuccessIcon; | ||
</script> | ||
|
||
<div class="inlineAlert {type}"> | ||
<svelte:component this={icon} /> | ||
<div class="alertContent"> | ||
<span class="header">{header}</span> | ||
<p class="description">{description}</p> | ||
</div> | ||
</div> | ||
|
||
<style> | ||
.primary { | ||
--icon: var(--primaryColor); | ||
--main-color: var(--primaryColor); | ||
} | ||
.success { | ||
--icon: var(--successColor); | ||
--main-color: var(--successColor); | ||
} | ||
.danger { | ||
--icon: var(--dangerColor); | ||
--main-color: var(--dangerColor); | ||
} | ||
.inlineAlert { | ||
width: var(--width, 100%); | ||
display: grid; | ||
grid-template-columns: repeat(2, auto); | ||
justify-content: start; | ||
gap: 0.75rem; | ||
padding: 0.5rem; | ||
border: 2px solid var(--main-color); | ||
border-radius: var(--border-radius); | ||
} | ||
.alertContent { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.5rem; | ||
} | ||
.alertContent .header { | ||
font-size: var(--body); | ||
font-family: var(--bodyFont); | ||
font-weight: 600; | ||
color: var(--foregroundColor); | ||
} | ||
.alertContent .description { | ||
font-size: var(--body); | ||
font-family: var(--bodyFont); | ||
color: var(--foregroundColor); | ||
} | ||
</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
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
Oops, something went wrong.