blob: f0a00c782519e37f037bcf318d62fc13ae83c8d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// @ts-nocheck
import { onMount } from "solid-js"
import * as mod from "./image-preview"
import { Button } from "./button"
import { useDialog } from "../context/dialog"
const docs = `### Overview
Image preview content intended to render inside the dialog stack.
Use for full-size image inspection; keep images optimized.
### API
- Required: \`src\`.
- Optional: \`alt\` text.
### Variants and states
- Single layout with close action.
### Behavior
- Intended to be used via \`useDialog().show\`.
### Accessibility
- Uses localized aria-label for close button.
### Theming/tokens
- Uses \`data-component="image-preview"\` and slot attributes.
`
export default {
title: "UI/ImagePreview",
id: "components-image-preview",
component: mod.ImagePreview,
tags: ["autodocs"],
parameters: {
docs: {
description: {
component: docs,
},
},
},
}
export const Basic = {
render: () => {
const dialog = useDialog()
const src = "https://placehold.co/640x360/png"
const open = () => dialog.show(() => <mod.ImagePreview src={src} alt="Preview" />)
onMount(open)
return (
<Button variant="secondary" onClick={open}>
Open image preview
</Button>
)
},
}
|