-
-
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
5 changed files
with
164 additions
and
7 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,94 @@ | ||
<script lang="ts"> | ||
import Logo from '$lib/components/Logo/Logo.svelte'; | ||
import Text from '$lib/components/Text/Text.svelte'; | ||
import type { Size } from '$lib/types.js'; | ||
import { cleanClass } from '$lib/utils.js'; | ||
import type { Snippet } from 'svelte'; | ||
import { tv } from 'tailwind-variants'; | ||
type Props = { | ||
effect?: 'hover' | 'always'; | ||
text?: string; | ||
size?: Size; | ||
children?: Snippet; | ||
}; | ||
const { effect = 'hover', text = 'Supporter', size = 'medium', children }: Props = $props(); | ||
const iconSize: Record<Size, Size> = { | ||
tiny: 'tiny', | ||
small: 'tiny', | ||
medium: 'small', | ||
large: 'medium', | ||
giant: 'medium', | ||
}; | ||
const containerStyles = tv({ | ||
base: 'bg-secondary flex place-items-center gap-2 overflow-hidden rounded-lg transition-all', | ||
variants: { | ||
size: { | ||
tiny: 'px-2 py-1', | ||
small: 'px-2 py-1', | ||
medium: 'px-3 py-2', | ||
large: 'px-3 py-2', | ||
giant: 'px-3 py-2', | ||
}, | ||
effect: { | ||
hover: 'border border-dark/25 supporter-effect-hover', | ||
always: 'shadow supporter-effect', | ||
}, | ||
}, | ||
}); | ||
</script> | ||
|
||
<div class={cleanClass(containerStyles({ effect, size }))}> | ||
{#if children} | ||
{@render children()} | ||
{:else} | ||
<Logo size={iconSize[size]} variant="icon" /> | ||
<Text fontWeight="normal" color="secondary" {size}>{text}</Text> | ||
{/if} | ||
</div> | ||
|
||
<style> | ||
.supporter-effect, | ||
.supporter-effect-hover:hover { | ||
position: relative; | ||
background-clip: padding-box; | ||
animation: gradient 10s ease infinite; | ||
z-index: 1; | ||
} | ||
.supporter-effect:after, | ||
.supporter-effect-hover:hover:after { | ||
position: absolute; | ||
top: 0px; | ||
bottom: 0px; | ||
left: 0px; | ||
right: 0px; | ||
background: linear-gradient( | ||
to right, | ||
rgba(16, 132, 254, 0.15), | ||
rgba(229, 125, 175, 0.15), | ||
rgba(254, 36, 29, 0.15), | ||
rgba(255, 183, 0, 0.15), | ||
rgba(22, 193, 68, 0.15) | ||
); | ||
content: ''; | ||
animation: gradient 10s ease infinite; | ||
background-size: 400% 400%; | ||
z-index: -1; | ||
} | ||
@keyframes gradient { | ||
0% { | ||
background-position: 0% 50%; | ||
} | ||
50% { | ||
background-position: 100% 50%; | ||
} | ||
100% { | ||
background-position: 0% 50%; | ||
} | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang="ts"> | ||
import DualThemeLayout from '$docs/components/DualThemeLayout.svelte'; | ||
import { sizes } from '$docs/constants.js'; | ||
import Heading from '$lib/components/Heading/Heading.svelte'; | ||
import { Card, CardBody, CardHeader, CardTitle, Logo, SupporterBadge, VStack } from '@immich/ui'; | ||
</script> | ||
|
||
<DualThemeLayout name="Link"> | ||
{#snippet component()} | ||
<Card> | ||
<CardHeader> | ||
<CardTitle>Effect</CardTitle> | ||
</CardHeader> | ||
<CardBody> | ||
<VStack class="w-[200px]"> | ||
<Heading size="tiny">On Hover</Heading> | ||
<SupporterBadge /> | ||
<Heading size="tiny">Always</Heading> | ||
<SupporterBadge effect="always" /> | ||
</VStack> | ||
</CardBody> | ||
</Card> | ||
<Card> | ||
<CardHeader> | ||
<CardTitle>Sizes</CardTitle> | ||
</CardHeader> | ||
<CardBody> | ||
<VStack> | ||
{#each sizes as size} | ||
<VStack class="w-[250px]"> | ||
<Heading size="tiny" class="capitalize">{size}</Heading> | ||
<SupporterBadge {size} effect="always" /> | ||
</VStack> | ||
{/each} | ||
</VStack> | ||
</CardBody> | ||
</Card> | ||
|
||
<Card> | ||
<CardHeader> | ||
<CardTitle>Custom</CardTitle> | ||
</CardHeader> | ||
<CardBody> | ||
<VStack> | ||
<VStack class="w-[250px]"> | ||
<SupporterBadge effect="always" text="Buy Immich" /> | ||
</VStack> | ||
|
||
<VStack> | ||
<Heading size="tiny">Title</Heading> | ||
<SupporterBadge effect="always"> | ||
<Logo size="large" variant="icon" /> | ||
<Heading size="large" color="primary">Purchase Immich</Heading> | ||
</SupporterBadge> | ||
</VStack> | ||
</VStack> | ||
</CardBody> | ||
</Card> | ||
{/snippet} | ||
</DualThemeLayout> |