Skip to content

Commit ad9a543

Browse files
authored
files (#29)
1 parent 3e1a0e8 commit ad9a543

File tree

12 files changed

+198
-0
lines changed

12 files changed

+198
-0
lines changed

app/pages/components/Empty.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script setup lang="ts">
2+
import { ArrowUpRightIcon, FolderCode } from "lucide-vue-next"
3+
import { Button } from "@/components/button"
4+
import {
5+
Empty,
6+
EmptyContent,
7+
EmptyDescription,
8+
EmptyHeader,
9+
EmptyMedia,
10+
EmptyTitle,
11+
} from "@/components/empty"
12+
</script>
13+
14+
<template>
15+
<Empty>
16+
<EmptyHeader>
17+
<EmptyMedia variant="icon">
18+
<FolderCode />
19+
</EmptyMedia>
20+
21+
<EmptyTitle>No Projects Yet</EmptyTitle>
22+
23+
<EmptyDescription>
24+
You haven't created any projects yet. Get started by creating your first project.
25+
</EmptyDescription>
26+
</EmptyHeader>
27+
28+
<EmptyContent>
29+
<div class="flex gap-2">
30+
<Button>Create Project</Button>
31+
32+
<Button variant="outline"> Import Project </Button>
33+
</div>
34+
</EmptyContent>
35+
36+
<Button variant="link" as-child class="text-muted-foreground" size="sm">
37+
<a href="#"> Learn More <ArrowUpRightIcon /> </a>
38+
</Button>
39+
</Empty>
40+
</template>

app/pages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export { default as ConfirmDialog } from "./components/ConfirmDialog.vue"
2323
export { default as Dialog } from "./components/Dialog.vue"
2424
export { default as Drawer } from "./components/Drawer.vue"
2525
export { default as DropdownMenu } from "./components/DropdownMenu.vue"
26+
export { default as Empty } from "./components/Empty.vue"
2627
export { default as Flasher } from "./components/Flasher.vue"
2728
export { default as Heading } from "./components/Heading.vue"
2829
export { default as Input } from "./components/Input.vue"

app/router/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
Dialog,
2828
Drawer,
2929
DropdownMenu,
30+
Empty,
3031
Flasher,
3132
Heading,
3233
Input,
@@ -138,6 +139,12 @@ const routes = [
138139
component: DropdownMenu,
139140
meta: { layout: ComponentLayout, shadcn: true },
140141
},
142+
{
143+
name: "Empty",
144+
path: "/components/empty",
145+
component: Empty,
146+
meta: { layout: ComponentLayout, shadcn: true },
147+
},
141148
{
142149
name: "Flasher",
143150
path: "/components/flasher",

src/components/empty/Empty.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from "vue"
3+
import { cn } from "@/lib/utils"
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes["class"]
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="empty"
13+
:class="
14+
cn(
15+
'flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg border-dashed p-6 text-center md:p-12',
16+
props.class
17+
)
18+
"
19+
>
20+
<slot />
21+
</div>
22+
</template>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from "vue"
3+
import { cn } from "@/lib/utils"
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes["class"]
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="empty-content"
13+
:class="
14+
cn(
15+
'flex w-full min-w-0 max-w-sm flex-col items-center gap-4 text-balance text-sm',
16+
props.class
17+
)
18+
"
19+
>
20+
<slot />
21+
</div>
22+
</template>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from "vue"
3+
import { cn } from "@/lib/utils"
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes["class"]
7+
}>()
8+
</script>
9+
10+
<template>
11+
<p
12+
data-slot="empty-description"
13+
:class="
14+
cn(
15+
'text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4',
16+
props.class
17+
)
18+
"
19+
>
20+
<slot />
21+
</p>
22+
</template>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from "vue"
3+
import { cn } from "@/lib/utils"
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes["class"]
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div
12+
data-slot="empty-header"
13+
:class="cn('flex max-w-sm flex-col items-center gap-2 text-center', props.class)"
14+
>
15+
<slot />
16+
</div>
17+
</template>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from "vue"
3+
import { cn } from "@/lib/utils"
4+
import { emptyMediaVariants } from "."
5+
import type { EmptyMediaVariants } from "."
6+
7+
const props = defineProps<{
8+
class?: HTMLAttributes["class"]
9+
variant?: EmptyMediaVariants["variant"]
10+
}>()
11+
</script>
12+
13+
<template>
14+
<div
15+
data-slot="empty-icon"
16+
:data-variant="variant"
17+
:class="cn(emptyMediaVariants({ variant }), props.class)"
18+
>
19+
<slot />
20+
</div>
21+
</template>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script setup lang="ts">
2+
import type { HTMLAttributes } from "vue"
3+
import { cn } from "@/lib/utils"
4+
5+
const props = defineProps<{
6+
class?: HTMLAttributes["class"]
7+
}>()
8+
</script>
9+
10+
<template>
11+
<div data-slot="empty-title" :class="cn('text-lg font-medium tracking-tight', props.class)">
12+
<slot />
13+
</div>
14+
</template>

src/components/empty/empty.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe("template spec", () => {
2+
it("passes", () => {
3+
cy.visit("/components/empty")
4+
})
5+
})

0 commit comments

Comments
 (0)