Skip to content

Commit

Permalink
feat: card styles
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 committed Nov 13, 2024
1 parent e1c01e3 commit 85d1e50
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 31 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"start": "npm run start:dev",
"start:dev": "vite dev",
"watch": "vite build --watch",
"build": "vite build && npm run package",
"preview": "vite preview",
"package": "npm run sync && svelte-package && publint",
Expand Down
14 changes: 7 additions & 7 deletions src/docs/examples/ButtonExamples.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<CardTitle>Shapes</CardTitle>
</CardHeader>
<CardBody>
<div class="flex gap-1">
<div class="flex flex-wrap gap-1">
{#each shapes as shape}
<Button {shape} class="capitalize">{shape}</Button>
{/each}
Expand All @@ -30,7 +30,7 @@
<CardTitle>Colors</CardTitle>
</CardHeader>
<CardBody>
<div class="flex gap-1">
<div class="flex flex-wrap gap-1">
{#each colors as color}
<Button {color} class="capitalize">{color}</Button>
{/each}
Expand All @@ -43,7 +43,7 @@
<CardTitle>Outline</CardTitle>
</CardHeader>
<CardBody>
<div class="flex gap-1">
<div class="flex flex-wrap gap-1">
{#each colors as color}
<Button variant="outline" {color}>Button</Button>
{/each}
Expand All @@ -56,7 +56,7 @@
<CardTitle>Ghost</CardTitle>
</CardHeader>
<CardBody>
<div class="flex gap-1">
<div class="flex flex-wrap gap-1">
{#each colors as color}
<Button variant="ghost" {color}>Button</Button>
{/each}
Expand All @@ -69,7 +69,7 @@
<CardTitle>Hero</CardTitle>
</CardHeader>
<CardBody>
<div class="flex gap-1">
<div class="flex flex-wrap gap-1">
{#each colors as color}
<Button variant="hero" {color}>Button</Button>
{/each}
Expand All @@ -82,7 +82,7 @@
<CardTitle>Disabled</CardTitle>
</CardHeader>
<CardBody>
<div class="flex gap-1">
<div class="flex flex-wrap gap-1">
{#each colors as color}
<Button {color} disabled>Button</Button>
{/each}
Expand All @@ -95,7 +95,7 @@
<CardTitle>Sizes</CardTitle>
</CardHeader>
<CardBody>
<div class="flex gap-1">
<div class="flex flex-wrap gap-1">
{#each sizes as size}
<div>
<Button {size} class="capitalize">{size}</Button>
Expand Down
5 changes: 4 additions & 1 deletion src/lib/components/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

<div
bind:this={ref}
class={cleanClass('rounded-lg border bg-light text-dark shadow-lg', className)}
class={cleanClass(
'rounded-lg border border-gray-300 bg-light text-dark shadow-lg dark:border-gray-600',
className,
)}
{...restProps}
>
{@render children?.()}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
spin = false,
role = 'img',
ariaLabelledby,
strokeColor = 'currentColor',
strokeColor = 'transparent',
strokeWidth = 2,
ariaLabel = '',
ariaHidden = false,
Expand Down
12 changes: 6 additions & 6 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import { routes } from '$docs/routes.js';
</script>

<section class="m-4 h-screen overflow-y-scroll p-4">
<h1 class="text-4xl">@immich/ui</h1>
<main>
<nav class="border-b border-gray-300 px-8 py-4">
<h1 class="text-4xl">@immich/ui</h1>
</nav>

<hr class="my-4" />

<div class="flex flex-col gap-2">
<div class="flex flex-col gap-2 px-8 py-4">
{#each routes as route}
<a href={route.link}>
<h3 class="text-xl underline">{route.name}</h3>
</a>
{/each}
</div>
</section>
</main>
54 changes: 39 additions & 15 deletions src/routes/examples/[component]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,29 +1,53 @@
<script lang="ts">
import { routes } from '$docs/routes.js';
import { Button, Icon } from '$lib/index.js';

Check failure on line 3 in src/routes/examples/[component]/+page.svelte

View workflow job for this annotation

GitHub Actions / Test

'Button' is defined but never used
import { mdiCompare } from '@mdi/js';
const { data } = $props();
const route = $derived(routes.find((route) => route.link === data.link));
let currentTheme = $state('both');
const currentThemes = $derived(currentTheme === 'both' ? ['light', 'dark'] : [currentTheme]);
const themes = ['both', 'light', 'dark'];
const handleClick = () => {
const currentIndex = themes.indexOf(currentTheme);
currentTheme = themes[(currentIndex + 1) % themes.length];
};
</script>

<div class="flex min-h-screen flex-col gap-4 bg-gray-200 p-8">
<div class="flex min-h-screen flex-col overflow-y-auto">
<!-- TODO replace with breadcrumb component -->
<div class="flex gap-1 rounded-lg bg-light p-2 text-dark">
<a href="/" class="flex gap-2 underline">Home</a>
<span>></span>
<!-- <span>Components</span> -->
<!-- <span>></span> -->
<span class="capitalize">{data.component}</span>
</div>
<nav class="flex items-center justify-between gap-2 border-b border-gray-300 px-8 py-2">
<a href="/" class="flex gap-2 text-4xl">
<h1 class="text-2xl">@immich/ui</h1>
</a>
<div>
<button onclick={handleClick}>
<Icon path={mdiCompare} size="24" class="cursor" />
</button>
</div>
</nav>

<nav class="flex justify-between border-b border-gray-300 px-8 py-2">
<div class="flex items-center gap-2">
<a href="/" class="underline">Home</a>
<span>/</span>
<span class="capitalize">{data.component}</span>
</div>
</nav>

<div class="flex gap-2">
{#if route}
{#each ['light', 'dark'] as theme}
<div class="flex w-1/2 flex-col {theme} gap-2">
{#if route}
<div class="grid grow grid-cols-1 {currentThemes.length === 2 ? 'md:grid-cols-2' : ''}">
{#each currentThemes as theme}
<div class="flex flex-col gap-4 {theme} h-full bg-light p-8">
<h2 class="text-2xl capitalize text-dark">{theme}</h2>
<route.component></route.component>
</div>
{/each}
{:else}
</div>
{:else}
<div class="p-8">
<h2 class="text-xl">No examples found for {data.component}</h2>
{/if}
</div>
</div>
{/if}
</div>
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Config } from 'tailwindcss';

export default {
content: ['./src/**/*.{html,js,svelte,ts}'],

darkMode: 'class',
theme: {
extend: {
colors: {
Expand Down

0 comments on commit 85d1e50

Please sign in to comment.