-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11c72e1
commit a765cf2
Showing
17 changed files
with
901 additions
and
15 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
Large diffs are not rendered by default.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
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,32 @@ | ||
<script lang="ts"> | ||
import { cn } from '$lib/utils.js'; | ||
import { type Props, badge_variants } from './index.js'; | ||
type $$Props = Props; | ||
let class_name: string | undefined | null = undefined; | ||
export let variant: $$Props['variant'] = undefined; | ||
export let title: $$Props['title']; | ||
export let description: $$Props['description']; | ||
export let icon_size: $$Props['icon_size'] = 32; | ||
export { class_name as class }; | ||
export let icon: $$Props['icon'] = undefined; | ||
$: icon_parent_size = icon_size ? icon_size + 28 : 32; | ||
</script> | ||
|
||
<div class={cn(badge_variants({ variant, className: class_name }))} {...$$restProps}> | ||
{#if icon} | ||
<span | ||
class="grid place-items-center rounded-lg border border-gray-alpha-400 bg-background-100 p-[14px]" | ||
style="width: {icon_parent_size}px; height: {icon_parent_size}px;" | ||
> | ||
<svelte:component this={icon} aria-hidden="true" width={icon_size} height={icon_size} /> | ||
</span> | ||
{/if} | ||
<div class="grid place-items-center gap-2"> | ||
<p class="text-lg font-medium text-gray-1000">{title}</p> | ||
<p class="text-balance text-sm">{description}</p> | ||
</div> | ||
<slot></slot> | ||
</div> |
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,22 @@ | ||
import type { Icons } from '$lib/assets/icons'; | ||
import { type VariantProps, tv } from 'tailwind-variants'; | ||
|
||
export { default as EmptyState } from './empty-state.svelte'; | ||
|
||
export const badge_variants = tv({ | ||
base: 'grid place-items-center gap-4 text-gray-900', | ||
variants: { | ||
variant: {} | ||
}, | ||
defaultVariants: {} | ||
}); | ||
|
||
type Variant = VariantProps<typeof badge_variants>['variant']; | ||
|
||
export type Props = { | ||
variant?: Variant; | ||
icon?: typeof Icons.Shield; | ||
title: string; | ||
description: string; | ||
icon_size?: number; | ||
}; |
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 |
---|---|---|
@@ -1 +1,42 @@ | ||
<h1>empty-state</h1> | ||
<script lang="ts"> | ||
import { Icons } from '$lib/assets/icons'; | ||
import Demo from '$lib/components/shared/demo.svelte'; | ||
import PageWrapper from '$lib/components/shared/page-wrapper.svelte'; | ||
import BlankSlate from './blank-slate.svelte'; | ||
import blank_slate_code from './blank-slate.svelte?raw'; | ||
import EmptyStateDesignFramework from './empty-state-design-framework.svelte'; | ||
import empty_state_design_framework_code from './empty-state-design-framework.svelte?raw'; | ||
import Informational from './informational.svelte'; | ||
import informational_code from './informational.svelte?raw'; | ||
export let data; | ||
const empty_state_design_framework_subtitle = | ||
'When designed thoughtfully, empty states become an essential part of a smooth user experience, providing enough context to keep users working in a productive way. There are several approaches to explore that will match the needs a developer in different situations:\n- __Blank Slate__ - Basic empty state for first run experience\n- __Informational__ - Alternative for first use empty state, including in-line CTAs and supplemental documentation links\n- __Educational__ - Launch a contextual onboarding flow to gain deeper understanding about that area of the app\n- __Guide__ - Starter content that allows users to interact with data and learn the system by tinkering or setting up their environment'; | ||
const informational_subtitle = | ||
'Help users by clearly explaining the benefit and utility of a product or feature, with a call to action and link to more information to help users progress.\n\nDefault to showing rather than telling the value of a feature. Certain entry points to a product may call for a unique empty state and a call to upgrade. Informational empty states will include a call to action.'; | ||
</script> | ||
|
||
<PageWrapper title={data.title} description={data.description}> | ||
<Demo | ||
id="empty-state-design-framework" | ||
subtitle={empty_state_design_framework_subtitle} | ||
code={empty_state_design_framework_code} | ||
> | ||
<Icons.ErrorStates aria-hidden="true" slot="image" /> | ||
<EmptyStateDesignFramework /> | ||
</Demo> | ||
|
||
<Demo | ||
id="blank-slate" | ||
subtitle="The most basic empty state should convey the state of the view." | ||
code={blank_slate_code} | ||
> | ||
<BlankSlate /> | ||
</Demo> | ||
|
||
<Demo id="informational" subtitle={informational_subtitle} code={informational_code}> | ||
<Informational /> | ||
</Demo> | ||
</PageWrapper> |
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,22 @@ | ||
import type { MetaTagsProps } from 'svelte-meta-tags'; | ||
|
||
export function load() { | ||
const title = 'Empty State'; | ||
const description = | ||
'Fill spaces when no content has been added yet, or is temporarily empty due to the nature of the feature and should be designed to prevent confusion.'; | ||
|
||
const pageMetaTags = Object.freeze({ | ||
title, | ||
description, | ||
openGraph: { | ||
title, | ||
description | ||
} | ||
}) satisfies MetaTagsProps; | ||
|
||
return { | ||
pageMetaTags, | ||
title, | ||
description | ||
}; | ||
} |
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,11 @@ | ||
<script lang="ts"> | ||
import { Icons } from '$lib/assets/icons'; | ||
import { EmptyState } from '$lib/components/ui/empty-state'; | ||
</script> | ||
|
||
<EmptyState | ||
title="Title" | ||
description="A message conveying the state of the product." | ||
icon={Icons.ChartBarPeak} | ||
icon_size={32} | ||
/> |
11 changes: 11 additions & 0 deletions
11
src/routes/empty-state/empty-state-design-framework.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,11 @@ | ||
<script lang="ts"> | ||
import { Icons } from '$lib/assets/icons'; | ||
import { EmptyState } from '$lib/components/ui/empty-state'; | ||
</script> | ||
|
||
<EmptyState | ||
title="Title" | ||
description="A message conveying the state of the product." | ||
icon={Icons.ChartBarPeak} | ||
icon_size={32} | ||
/> |
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,17 @@ | ||
<script lang="ts"> | ||
import { Icons } from '$lib/assets/icons'; | ||
import { Button } from '$lib/components/ui/button'; | ||
import { EmptyState } from '$lib/components/ui/empty-state'; | ||
</script> | ||
|
||
<EmptyState | ||
description="This should detail the actions you can take on this screen, as well as why it's valuable." | ||
icon={Icons.ChartBarPeak} | ||
icon_size={32} | ||
title="Title" | ||
> | ||
<Button variant="secondary">Primary Action</Button> | ||
<!-- <Link external href="/" variant="secondary"> | ||
Learn more | ||
</Link> --> | ||
</EmptyState> |