-
-
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
12 changed files
with
135 additions
and
12 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,66 @@ | ||
<script lang="ts"> | ||
import type { Size } from '$lib/types.js'; | ||
import { tv } from 'tailwind-variants'; | ||
type Props = { | ||
size?: Size; | ||
color?: | ||
| 'primary' | ||
| 'pink' | ||
| 'red' | ||
| 'yellow' | ||
| 'blue' | ||
| 'green' | ||
| 'purple' | ||
| 'orange' | ||
| 'gray' | ||
| 'amber'; | ||
name: string; | ||
}; | ||
const { color = 'primary', size = 'medium', name }: Props = $props(); | ||
const styles = tv({ | ||
base: 'flex h-full w-full select-none items-center justify-center font-medium', | ||
variants: { | ||
size: { | ||
tiny: 'w-5 h-5 text-xs', | ||
small: 'w-7 h-7 text-sm', | ||
medium: 'w-10 h-10 text-md', | ||
large: 'w-12 h-12 text-lg', | ||
giant: 'w-16 h-16 text-xl', | ||
}, | ||
color: { | ||
primary: 'bg-primary text-light', | ||
pink: 'bg-pink-400 text-light', | ||
red: 'bg-red-500 text-light', | ||
yellow: 'bg-yellow-500 text-light', | ||
purple: 'bg-purple-600 text-dark', | ||
orange: 'bg-orange-600 text-light', | ||
gray: 'bg-gray-600 text-dark', | ||
amber: 'bg-amber-600 text-light', | ||
blue: 'bg-blue-500 text-dark', | ||
green: 'bg-green-600 text-dark', | ||
}, | ||
}, | ||
}); | ||
const wrapper = tv({ | ||
base: 'overflow-hidden shadow-md rounded rounded-full', | ||
}); | ||
const getInitials = (name: string) => { | ||
return name | ||
.split(' ') | ||
.map((part) => part.at(0)) | ||
.join('') | ||
.substr(0, 2) | ||
.toUpperCase(); | ||
}; | ||
const initials = $derived(getInitials(name)); | ||
</script> | ||
|
||
<figure class={wrapper()}> | ||
<span class={styles({ size, color })}>{initials}</span> | ||
</figure> |
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,17 @@ | ||
<script lang="ts"> | ||
import ExampleLayout from '$docs/components/ExampleLayout.svelte'; | ||
import BasicExample from './BasicExample.svelte'; | ||
import basicExample from './BasicExample.svelte?raw'; | ||
import ColorExample from './ColorExample.svelte'; | ||
import colorExample from './ColorExample.svelte?raw'; | ||
import SizeExample from './SizeExample.svelte'; | ||
import sizeExample from './SizeExample.svelte?raw'; | ||
const examples = [ | ||
{ title: 'Basic', code: basicExample, component: BasicExample }, | ||
{ title: 'Color', code: colorExample, component: ColorExample }, | ||
{ title: 'Size', code: sizeExample, component: SizeExample }, | ||
]; | ||
</script> | ||
|
||
<ExampleLayout name="Avatar" {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,7 @@ | ||
<script lang="ts"> | ||
import { Avatar, HStack } from '@immich/ui'; | ||
</script> | ||
|
||
<HStack> | ||
<Avatar name="Immich User" /> | ||
</HStack> |
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,16 @@ | ||
<script lang="ts"> | ||
import { Avatar, HStack } from '@immich/ui'; | ||
</script> | ||
|
||
<HStack> | ||
<Avatar color="primary" name="Immich User" /> | ||
<Avatar color="gray" name="Immich User" /> | ||
<Avatar color="purple" name="Immich User" /> | ||
<Avatar color="blue" name="Immich User" /> | ||
<Avatar color="green" name="Immich User" /> | ||
<Avatar color="yellow" name="Immich User" /> | ||
<Avatar color="amber" name="Immich User" /> | ||
<Avatar color="orange" name="Immich User" /> | ||
<Avatar color="red" name="Immich User" /> | ||
<Avatar color="pink" name="Immich User" /> | ||
</HStack> |
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 { Avatar, HStack } from '@immich/ui'; | ||
</script> | ||
|
||
<HStack> | ||
<Avatar size="tiny" name="Immich User" /> | ||
<Avatar size="small" name="Immich User" /> | ||
<Avatar size="medium" name="Immich User" /> | ||
<Avatar size="large" name="Immich User" /> | ||
<Avatar size="giant" name="Immich User" /> | ||
</HStack> |
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