Files
heroui-vue/apps/docs/demos/card-with-images.vue
T
maoyingjie 53e76f676d fix(demos): restore form, overlay and toast demos to the pinned cn baseline
HD-02 scope, all against heroui ce90ea3 cn sources:

- card: add the text-primary class to the coin icons (source parity);
  card-with-form drops the added required validation and inline business
  note, restores the plain href="#" forgot-password link and the baseline
  alert("表单提交成功!") submit feedback (autocomplete kept: no visible
  impact, allowed by the task card)
- input-group-with-textarea: restore the four Tooltips and the Enter Kbd
  hint; drop the stale "Tooltip 组件尚未迁移" note from input-group.md
- alert-dialog: restore the h-px top light line in custom-styles and the
  truncated/missing description text in sizes/custom-portal/
  custom-animations (+ controlled); align the fluid-slide icon with the
  modal mapping (IconArrowBarUp for gravity-ui:arrow-up-from-line)
- toast: restore the upstream demo layout shells (variants/simple/
  custom-indicator/custom-queue) and the action button default variant:
  ToastActionButton now falls back to the Button defaults (primary/md)
  like upstream ToastActionButton, so variants' actions render primary,
  danger stays danger and default stays tertiary; toast.md defaults fixed
- submit demos: restore baseline feedback and structure — alert() for
  card/fieldset/form/checkbox/checkbox-group/switch/select/combo-box/
  autocomplete and console.log for search/number/time field form examples;
  modal-with-form returns to the close-only footer (no submit/result row);
  drop the added inline status/result rows and the max-w-full/
  max-sm:min-w-0 width guards from the restored demos
- radio-group-validation: add the missing text-muted to the result line;
  label.md invalid example gives the real control its invalid state and
  matches the baseline input shape

Tests re-pinned to the baseline contracts (alert/console/close behavior,
four tooltips + Kbd, positional modal footer); full suite 110 files /
1617 tests, typecheck, build:docs and the m35-m36 tarball contract pass.
2026-10-28 14:10:10 +08:00

275 lines
10 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { IconCoin } from "@tabler/icons-vue";
import {
Card,
CardHeader,
CardTitle,
CardDescription,
CardContent,
CardFooter,
Button,
CloseButton,
Avatar,
AvatarImage,
AvatarFallback,
Link,
LinkIcon,
} from "@heroui-vue/components";
</script>
<template>
<div class="flex w-full items-center justify-center">
<div class="grid w-full max-w-2xl grid-cols-12 gap-4 p-4">
<Card class="col-span-12 flex h-auto min-h-[152px] flex-col sm:flex-row">
<div
class="relative h-[140px] w-full shrink-0 overflow-hidden rounded-2xl sm:h-[120px] sm:w-[120px]"
>
<img
alt="樱桃"
class="pointer-events-none absolute inset-0 h-full w-full scale-125 object-cover select-none"
loading="lazy"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/cherries.jpeg"
/>
</div>
<div class="flex flex-1 flex-col gap-3">
<CardHeader class="gap-1">
<CardTitle class="pe-8">成为 ACME 创作者!</CardTitle>
<CardDescription>
这是一段占位说明文字,用于展示横向卡片布局、配图与右上角关闭按钮的排版效果。
</CardDescription>
<CloseButton aria-label="关闭横幅" class="absolute end-3 top-3" />
</CardHeader>
<CardFooter
class="mt-auto flex w-full flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between"
>
<div class="flex flex-col">
<span class="text-sm font-medium text-foreground">
仅剩 10 个名额
</span>
<span class="text-xs text-muted">报名截止:10 月 10 日</span>
</div>
<Button class="w-full sm:w-auto">立即申请</Button>
</CardFooter>
</div>
</Card>
<div class="col-span-12 grid grid-cols-12 gap-4">
<div class="col-span-12 grid grid-cols-12 gap-4 lg:col-span-6">
<Card class="col-span-12">
<div class="absolute end-3 top-3 z-10">
<CloseButton aria-label="关闭通知" />
</div>
<CardHeader class="gap-3">
<IconCoin
role="img"
aria-label="美元图标"
class="text-primary size-8 shrink-0"
/>
<div class="flex flex-col gap-1">
<span class="text-xs font-medium text-muted uppercase">
支付
</span>
<CardTitle class="pe-8 text-sm sm:text-base">
现已支持加密货币提现
</CardTitle>
<CardDescription class="text-xs sm:text-sm">
在设置中添加钱包即可提现
</CardDescription>
</div>
</CardHeader>
<CardFooter>
<Link aria-label="前往设置" href="#" rel="noopener noreferrer">
前往设置
<LinkIcon aria-hidden="true" />
</Link>
</CardFooter>
</Card>
<div class="col-span-12 grid grid-cols-12 gap-4">
<Card class="col-span-12 gap-2 sm:col-span-6">
<CardHeader>
<Avatar
class="inline-flex shrink-0 overflow-hidden rounded-full size-[56px] rounded-xl"
>
<AvatarImage
class="size-full object-cover"
alt="演示图片 1"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/demo1.jpg"
/>
<AvatarFallback
class="flex size-full items-center justify-center bg-default"
>
JK
</AvatarFallback>
</Avatar>
</CardHeader>
<CardContent class="mt-1">
<p class="text-sm leading-4 font-medium">Indie Hackers</p>
<p class="text-xs text-muted">148 位成员</p>
</CardContent>
<CardFooter class="flex items-center gap-2">
<Avatar
class="inline-flex shrink-0 overflow-hidden rounded-full size-4"
>
<AvatarImage
class="size-full object-cover"
alt="约翰"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/red.jpg"
/>
<AvatarFallback
class="flex size-full items-center justify-center bg-default"
>
JK
</AvatarFallback>
</Avatar>
<p class="text-xs text-muted">创建者:约翰</p>
</CardFooter>
</Card>
<Card class="col-span-12 gap-2 sm:col-span-6">
<CardHeader>
<Avatar
class="inline-flex shrink-0 overflow-hidden rounded-full size-[56px] rounded-xl"
>
<AvatarImage
class="size-full object-cover"
alt="演示图片 2"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/demo2.jpg"
/>
<AvatarFallback
class="flex size-full items-center justify-center bg-default"
>
AB
</AvatarFallback>
</Avatar>
</CardHeader>
<CardContent class="mt-1">
<p class="text-sm leading-4 font-medium">AI Builders</p>
<p class="text-xs text-muted">362 位成员</p>
</CardContent>
<CardFooter class="flex items-center gap-2">
<Avatar
class="inline-flex shrink-0 overflow-hidden rounded-full size-4"
>
<AvatarImage
class="size-full object-cover"
alt="玛莎"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
/>
<AvatarFallback
class="flex size-full items-center justify-center bg-default"
>
M
</AvatarFallback>
</Avatar>
<p class="text-xs text-muted">创建者:玛莎</p>
</CardFooter>
</Card>
</div>
</div>
<Card
class="col-span-12 min-h-[200px] overflow-hidden rounded-3xl lg:col-span-6"
>
<img
alt="NEO 家用机器人"
aria-hidden="true"
class="absolute inset-0 h-full w-full object-cover"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/neo2.jpeg"
/>
<CardHeader class="z-10 text-white">
<CardTitle
class="text-xs font-semibold tracking-wide text-black/70"
>
NEO
</CardTitle>
<CardDescription
class="text-sm leading-5 font-medium text-black/50"
>
家用机器人
</CardDescription>
</CardHeader>
<CardFooter class="z-10 mt-auto flex items-center justify-between">
<div>
<div class="text-sm font-medium text-black">即将推出</div>
<div class="text-xs text-black/60">接收上架通知</div>
</div>
<Button class="bg-white text-black" size="sm" variant="tertiary">
通知我
</Button>
</CardFooter>
</Card>
</div>
<div class="col-span-12 grid grid-cols-12 gap-4">
<Card
class="relative col-span-12 h-[250px] sm:h-[300px] md:col-span-8 md:h-[350px]"
>
<img
alt="NEO 家用机器人"
aria-hidden="true"
class="absolute inset-0 h-full w-full object-cover"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/neo1.jpeg"
/>
<CardFooter class="z-10 mt-auto flex items-end justify-between">
<div>
<div class="text-base font-medium text-black sm:text-lg">NEO</div>
<div class="text-xs font-medium text-black/50 sm:text-sm">
$499/月
</div>
</div>
<Button class="bg-white text-black" size="sm" variant="tertiary">
立即购买
</Button>
</CardFooter>
</Card>
<div
class="col-span-12 flex flex-col gap-2 md:col-span-4 md:justify-between md:gap-0 md:py-2"
>
<Card class="flex flex-row gap-3 p-1" variant="transparent">
<img
alt="未来感机器人"
class="aspect-square h-16 w-16 shrink-0 rounded-xl object-cover select-none sm:h-20 sm:w-20"
loading="lazy"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/robot1.jpeg"
/>
<div class="flex flex-1 flex-col justify-center gap-1">
<CardTitle class="text-sm">连接未来</CardTitle>
<CardDescription class="text-xs">今天 18:30</CardDescription>
</div>
</Card>
<Card class="flex flex-row gap-3 p-1" variant="transparent">
<img
alt="牛油果"
class="aspect-square h-16 w-16 shrink-0 rounded-xl object-cover select-none sm:h-20 sm:w-20"
loading="lazy"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/avocado.jpeg"
/>
<div class="flex flex-1 flex-col justify-center gap-1">
<CardTitle class="text-sm">牛油果黑客松</CardTitle>
<CardDescription class="text-xs">周三 16:30</CardDescription>
</div>
</Card>
<Card class="flex flex-row gap-3 p-1" variant="transparent">
<img
alt="Sound Electro 活动"
class="aspect-square h-16 w-16 shrink-0 rounded-xl object-cover select-none sm:h-20 sm:w-20"
loading="lazy"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/oranges.jpeg"
/>
<div class="flex flex-1 flex-col justify-center gap-1">
<CardTitle class="text-sm">Sound Electro|超越艺术</CardTitle>
<CardDescription class="text-xs">周五 20:00</CardDescription>
</div>
</Card>
</div>
</div>
</div>
</div>
</template>