snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
70
apps/v4/examples/aria/attachment-image.tsx
Normal file
70
apps/v4/examples/aria/attachment-image.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
import { XIcon } from "lucide-react"
|
||||
|
||||
import {
|
||||
Attachment,
|
||||
AttachmentAction,
|
||||
AttachmentActions,
|
||||
AttachmentContent,
|
||||
AttachmentDescription,
|
||||
AttachmentGroup,
|
||||
AttachmentMedia,
|
||||
AttachmentTitle,
|
||||
AttachmentTrigger,
|
||||
} from "@/styles/aria-rhea/ui/attachment"
|
||||
|
||||
const images = [
|
||||
{
|
||||
name: "workspace.png",
|
||||
meta: "PNG · 820 KB",
|
||||
src: "https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80",
|
||||
alt: "Workspace",
|
||||
},
|
||||
{
|
||||
name: "desk-reference.jpg",
|
||||
meta: "JPG · 1.1 MB",
|
||||
src: "https://images.unsplash.com/photo-1497215728101-856f4ea42174?w=900&auto=format&fit=crop&q=80",
|
||||
alt: "Desk",
|
||||
},
|
||||
{
|
||||
name: "office-reference.jpg",
|
||||
meta: "JPG · 940 KB",
|
||||
src: "https://images.unsplash.com/photo-1497366811353-6870744d04b2?w=900&auto=format&fit=crop&q=80",
|
||||
alt: "Office",
|
||||
},
|
||||
]
|
||||
|
||||
export function AttachmentImage() {
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-sm py-12">
|
||||
<AttachmentGroup className="w-full">
|
||||
{images.map((image) => (
|
||||
<Attachment key={image.name} orientation="vertical">
|
||||
<AttachmentMedia variant="image">
|
||||
<img src={image.src} alt={image.alt} />
|
||||
</AttachmentMedia>
|
||||
<AttachmentContent>
|
||||
<AttachmentTitle>{image.name}</AttachmentTitle>
|
||||
<AttachmentDescription>{image.meta}</AttachmentDescription>
|
||||
</AttachmentContent>
|
||||
<AttachmentActions>
|
||||
<AttachmentAction aria-label={`Remove ${image.name}`}>
|
||||
<XIcon />
|
||||
</AttachmentAction>
|
||||
</AttachmentActions>
|
||||
<AttachmentTrigger
|
||||
render={(props) => (
|
||||
<a
|
||||
{...props}
|
||||
href={image.src}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
aria-label={`Open ${image.name}`}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Attachment>
|
||||
))}
|
||||
</AttachmentGroup>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user