-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* component: error state * link * explicit --------- Co-authored-by: Davis SHYAKA <87414827+davis-shyaka@users.noreply.github.com>
- Loading branch information
1 parent
11c72e1
commit 49c51d1
Showing
22 changed files
with
1,005 additions
and
16 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.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { Button as LinkPrimitive } from 'bits-ui'; | ||
import { type VariantProps, tv } from 'tailwind-variants'; | ||
import Link from './link.svelte'; | ||
|
||
const link_variants = tv({ | ||
base: 'inline-flex select-none items-center justify-center gap-x-1 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background-200 transition-[background,color,transform,box-shadow] ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-color focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:text-gray-700 [&>svg]:size-3', | ||
variants: { | ||
variant: { | ||
default: '', | ||
secondary: 'text-accents-5 hover:text-gray-1000', | ||
tertiary: '', | ||
error: '', | ||
warning: '' | ||
} | ||
}, | ||
defaultVariants: { | ||
variant: 'default' | ||
} | ||
}); | ||
|
||
type Variant = VariantProps<typeof link_variants>['variant']; | ||
|
||
type Props = LinkPrimitive.Props & { | ||
variant?: Variant; | ||
external?: boolean; | ||
href: string; | ||
}; | ||
|
||
type Events = LinkPrimitive.Events; | ||
|
||
export { | ||
Link, | ||
link_variants, | ||
type Events as ButtonEvents, | ||
type Props as ButtonProps, | ||
type Events, | ||
type Props | ||
}; |
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 { Icons } from '$lib/assets/icons/index.js'; | ||
import { cn } from '$lib/utils.js'; | ||
import { Button as LinkPrimitive } from 'bits-ui'; | ||
import { type Events, type Props, link_variants } from './index.js'; | ||
type $$Props = Props; | ||
type $$Events = Events; | ||
let class_name: $$Props['class'] = undefined; | ||
export let variant: $$Props['variant'] = 'default'; | ||
export let href: $$Props['href']; | ||
export let builders: $$Props['builders'] = []; | ||
export let external: $$Props['external'] = false; | ||
export { class_name as class }; | ||
</script> | ||
|
||
<LinkPrimitive.Root | ||
{builders} | ||
class={cn(link_variants({ variant, className: class_name }))} | ||
{href} | ||
target={external ? '_blank' : undefined} | ||
rel={external ? 'noopener noreferrer' : undefined} | ||
{...$$restProps} | ||
on:click | ||
on:keydown | ||
> | ||
<slot /> | ||
{#if external} | ||
<Icons.External aria-hidden="true" /> | ||
{/if} | ||
</LinkPrimitive.Root> |
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} | ||
/> |
Oops, something went wrong.