Skip to content

Commit

Permalink
feat: team card
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <[email protected]>
  • Loading branch information
ZTL-UwU committed Nov 16, 2024
1 parent bac29ee commit da62392
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 0 deletions.
38 changes: 38 additions & 0 deletions components/content/TeamCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<template>
<UiCard>
<UiCardHeader>
<div class="flex flex-col gap-3" :class="{ 'text-center': center }">
<UiAvatar :class="{ 'mx-auto': center }">
<UiAvatarImage :src="avatar" :alt="name" />
</UiAvatar>
<div>
<div class="text-lg font-bold">
{{ name }}
</div>
<div class="text-sm text-muted-foreground">
{{ title }}
</div>
</div>
<div class="flex gap-3 text-secondary-foreground" :class="{ 'mx-auto': center }">
<NuxtLink v-for="link in links" :key="link.to" :to="link.to">
<SmartIcon :name="link.icon" />
</NuxtLink>
</div>
</div>
</UiCardHeader>
</UiCard>
</template>

<script setup lang="ts">
const { center = true } = defineProps<{
avatar: string;
name: string;
title?: string;
links?: ({
icon: string;
to: string;
target?: Target;
})[];
center?: boolean;
}>();
</script>
5 changes: 5 additions & 0 deletions components/content/TeamCardGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div class="grid grid-cols-[repeat(auto-fit,_minmax(270px,_1fr))] gap-6">
<slot />
</div>
</template>
21 changes: 21 additions & 0 deletions components/ui/avatar/Avatar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<AvatarRoot :class="cn(avatarVariant({ size, shape }), props.class)">
<slot />
</AvatarRoot>
</template>

<script setup lang="ts">
import type { HTMLAttributes } from 'vue';
import { cn } from '@/lib/utils';
import { AvatarRoot } from 'radix-vue';
import { avatarVariant, type AvatarVariants } from '.';
const props = withDefaults(defineProps<{
class?: HTMLAttributes['class'];
size?: AvatarVariants['size'];
shape?: AvatarVariants['shape'];
}>(), {
size: 'sm',
shape: 'circle',
});
</script>
11 changes: 11 additions & 0 deletions components/ui/avatar/AvatarFallback.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<AvatarFallback v-bind="props">
<slot />
</AvatarFallback>
</template>

<script setup lang="ts">
import { AvatarFallback, type AvatarFallbackProps } from 'radix-vue';
const props = defineProps<AvatarFallbackProps>();
</script>
9 changes: 9 additions & 0 deletions components/ui/avatar/AvatarImage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<AvatarImage v-bind="props" class="size-full object-cover" />
</template>

<script setup lang="ts">
import { AvatarImage, type AvatarImageProps } from 'radix-vue';
const props = defineProps<AvatarImageProps>();
</script>
24 changes: 24 additions & 0 deletions components/ui/avatar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { cva, type VariantProps } from 'class-variance-authority';

export { default as Avatar } from './Avatar.vue';
export { default as AvatarFallback } from './AvatarFallback.vue';
export { default as AvatarImage } from './AvatarImage.vue';

export const avatarVariant = cva(
'inline-flex shrink-0 select-none items-center justify-center overflow-hidden bg-secondary font-normal text-foreground',
{
variants: {
size: {
sm: 'size-10 text-xs',
base: 'size-16 text-2xl',
lg: 'size-32 text-5xl',
},
shape: {
circle: 'rounded-full',
square: 'rounded-md',
},
},
},
);

export type AvatarVariants = VariantProps<typeof avatarVariant>;
85 changes: 85 additions & 0 deletions content/2.components/3.page/team-card.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: Team Card
icon: lucide:users
description: ''
navBadges:
- value: New
type: lime
badges:
- value: Source
icon: lucide:code
to: https://github.com/ZTL-UwU/shadcn-docs-nuxt/blob/main/components/content/TeamCard.vue
target: _blank
- value: 0.7.7
---

::code-group
::div{label="Preview" class="md:p-4"}
::team-card-group
::team-card
---
avatar: https://www.github.com/ZTL-UwU.png
name: Tony Zhang
title: Author of shadcn-docs-nuxt
links:
- icon: lucide:github
to: https://github.com/ZTL-UwU
- icon: lucide:twitter
to: https://x.com/ZTL_UwU
- icon: lucide:coffee
to: https://ko-fi.com/ztl_uwu
---
::

::team-card
---
center: false
avatar: https://www.github.com/ZTL-UwU.png
name: Tony Zhang
title: Author of shadcn-docs-nuxt
links:
- icon: lucide:github
to: https://github.com/ZTL-UwU
- icon: lucide:twitter
to: https://x.com/ZTL_UwU
- icon: lucide:coffee
to: https://ko-fi.com/ztl_uwu
---
::
::
::
```mdc [Code]
::team-card-group
::team-card
---
avatar: https://www.github.com/ZTL-UwU.png
name: Tony Zhang
title: Author of shadcn-docs-nuxt
links:
- icon: lucide:github
to: https://github.com/ZTL-UwU
- icon: lucide:twitter
to: https://x.com/ZTL_UwU
- icon: lucide:coffee
to: https://ko-fi.com/ztl_uwu
---
::
::team-card
---
center: false
avatar: https://www.github.com/ZTL-UwU.png
name: Tony Zhang
title: Author of shadcn-docs-nuxt
links:
- icon: lucide:github
to: https://github.com/ZTL-UwU
- icon: lucide:twitter
to: https://x.com/ZTL_UwU
- icon: lucide:coffee
to: https://ko-fi.com/ztl_uwu
---
::
::
```
::

0 comments on commit da62392

Please sign in to comment.