-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
7 changed files
with
115 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang="ts"> | ||
import type { Color, Size } from '$lib/types.js'; | ||
import type { Snippet } from 'svelte'; | ||
import { tv } from 'tailwind-variants'; | ||
type Props = { | ||
color?: Color; | ||
size?: Size; | ||
variant?: 'filled'; | ||
children: Snippet; | ||
}; | ||
const { size = 'medium', variant, color = 'secondary', children }: Props = $props(); | ||
const styles = tv({ | ||
base: 'font-monospace', | ||
variants: { | ||
textColor: { | ||
primary: 'text-primary', | ||
secondary: 'text-dark', | ||
success: 'text-success', | ||
danger: 'text-danger', | ||
warning: 'text-warning', | ||
info: 'text-info', | ||
}, | ||
filled: { | ||
true: 'rounded px-2 py-1', | ||
false: '', | ||
}, | ||
filledColor: { | ||
false: '', | ||
primary: 'bg-primary text-light', | ||
secondary: 'bg-dark text-light', | ||
success: 'bg-success text-light', | ||
danger: 'bg-danger text-light', | ||
warning: 'bg-warning text-light', | ||
info: 'bg-info text-dark', | ||
}, | ||
size: { | ||
tiny: 'text-xs', | ||
small: 'text-sm', | ||
medium: 'text-md', | ||
large: 'text-lg', | ||
giant: 'text-xl', | ||
}, | ||
}, | ||
}); | ||
</script> | ||
|
||
<code | ||
class={styles({ | ||
filled: variant === 'filled', | ||
filledColor: variant === 'filled' && color, | ||
textColor: color, | ||
size, | ||
})}>{@render children()}</code | ||
> |
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,17 @@ | ||
<script lang="ts"> | ||
import ExampleLayout from '$docs/components/ExampleLayout.svelte'; | ||
import ColorExample from './ColorExample.svelte'; | ||
import colorExample from './ColorExample.svelte?raw'; | ||
import FilledExample from './FilledExample.svelte'; | ||
import filledExample from './FilledExample.svelte?raw'; | ||
import SizeExample from './SizeExample.svelte'; | ||
import sizeExample from './SizeExample.svelte?raw'; | ||
const examples = [ | ||
{ title: 'Size', code: sizeExample, component: SizeExample }, | ||
{ title: 'Color', code: colorExample, component: ColorExample }, | ||
{ title: 'Filled', code: filledExample, component: FilledExample }, | ||
]; | ||
</script> | ||
|
||
<ExampleLayout name="Code" {examples} /> |
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,12 @@ | ||
<script lang="ts"> | ||
import { Code, Stack } from '@immich/ui'; | ||
</script> | ||
|
||
<Stack> | ||
<Code color="primary">console.log('hello world!')</Code> | ||
<Code color="secondary">console.log('hello world!')</Code> | ||
<Code color="success">console.log('hello world!')</Code> | ||
<Code color="info">console.log('hello world!')</Code> | ||
<Code color="warning">console.log('hello world!')</Code> | ||
<Code color="danger">console.log('hello world!')</Code> | ||
</Stack> |
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,12 @@ | ||
<script lang="ts"> | ||
import { Code, Stack } from '@immich/ui'; | ||
</script> | ||
|
||
<Stack> | ||
<Code variant="filled" color="primary">console.log('hello world!')</Code> | ||
<Code variant="filled" color="secondary">console.log('hello world!')</Code> | ||
<Code variant="filled" color="success">console.log('hello world!')</Code> | ||
<Code variant="filled" color="info">console.log('hello world!')</Code> | ||
<Code variant="filled" color="warning">console.log('hello world!')</Code> | ||
<Code variant="filled" color="danger">console.log('hello world!')</Code> | ||
</Stack> |
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 { Code, Stack } from '@immich/ui'; | ||
</script> | ||
|
||
<Stack> | ||
<Code size="tiny">console.log('hello world!')</Code> | ||
<Code size="small">console.log('hello world!')</Code> | ||
<Code size="medium">console.log('hello world!')</Code> | ||
<Code size="large">console.log('hello world!')</Code> | ||
<Code size="giant">console.log('hello world!')</Code> | ||
</Stack> |