|
| 1 | +// Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | + |
| 3 | +'use client'; |
| 4 | + |
| 5 | +/** |
| 6 | + * @file DialogHeroHeaderShowcase.tsx |
| 7 | + * @input DialogHeroHeader composed with Dialog and Layout |
| 8 | + * @output A dismissible onboarding preview with full-bleed decorative media |
| 9 | + * @position Canary Lab showcase shared by CLI discovery, docsite, and Storybook |
| 10 | + */ |
| 11 | + |
| 12 | +import {useId, useState} from 'react'; |
| 13 | +import * as stylex from '@stylexjs/stylex'; |
| 14 | +import {DialogHeroHeader} from '@astryxdesign/lab'; |
| 15 | +import {Button} from '@astryxdesign/core/Button'; |
| 16 | +import {Dialog} from '@astryxdesign/core/Dialog'; |
| 17 | +import {Layout, LayoutContent, LayoutFooter} from '@astryxdesign/core/Layout'; |
| 18 | +import {Text} from '@astryxdesign/core/Text'; |
| 19 | + |
| 20 | +const styles = stylex.create({ |
| 21 | + artwork: { |
| 22 | + display: 'block', |
| 23 | + }, |
| 24 | +}); |
| 25 | + |
| 26 | +export default function DialogHeroHeaderShowcase() { |
| 27 | + const [isOpen, setIsOpen] = useState(true); |
| 28 | + const gradientId = useId(); |
| 29 | + |
| 30 | + return isOpen ? ( |
| 31 | + <Dialog isOpen isInline onOpenChange={setIsOpen}> |
| 32 | + <Layout |
| 33 | + header={ |
| 34 | + <DialogHeroHeader |
| 35 | + title="Make room for your next idea" |
| 36 | + media={ |
| 37 | + <svg |
| 38 | + viewBox="0 0 480 180" |
| 39 | + width="100%" |
| 40 | + height="180" |
| 41 | + preserveAspectRatio="xMidYMid slice" |
| 42 | + aria-hidden="true" |
| 43 | + {...stylex.props(styles.artwork)}> |
| 44 | + <defs> |
| 45 | + <linearGradient id={gradientId} x1="0" y1="0" x2="1" y2="1"> |
| 46 | + <stop offset="0%" stopColor="#1c2340" /> |
| 47 | + <stop offset="100%" stopColor="#3b2d5e" /> |
| 48 | + </linearGradient> |
| 49 | + </defs> |
| 50 | + <rect width="480" height="180" fill={`url(#${gradientId})`} /> |
| 51 | + <circle cx="390" cy="40" r="70" fill="#8ba7ff" opacity="0.35" /> |
| 52 | + <circle cx="70" cy="170" r="90" fill="#8ba7ff" opacity="0.25" /> |
| 53 | + <circle cx="240" cy="90" r="42" fill="#8ba7ff" opacity="0.55" /> |
| 54 | + </svg> |
| 55 | + } |
| 56 | + mediaMode="dark" |
| 57 | + onOpenChange={setIsOpen} |
| 58 | + /> |
| 59 | + } |
| 60 | + content={ |
| 61 | + <LayoutContent> |
| 62 | + <Text type="body"> |
| 63 | + Bring your notes, projects, and collaborators together in one |
| 64 | + workspace. You can make it your own as you go. |
| 65 | + </Text> |
| 66 | + </LayoutContent> |
| 67 | + } |
| 68 | + footer={ |
| 69 | + <LayoutFooter> |
| 70 | + <Button |
| 71 | + label="Get started" |
| 72 | + variant="primary" |
| 73 | + onClick={() => setIsOpen(false)} |
| 74 | + /> |
| 75 | + </LayoutFooter> |
| 76 | + } |
| 77 | + /> |
| 78 | + </Dialog> |
| 79 | + ) : ( |
| 80 | + <Button |
| 81 | + label="Preview welcome dialog" |
| 82 | + variant="secondary" |
| 83 | + onClick={() => setIsOpen(true)} |
| 84 | + /> |
| 85 | + ); |
| 86 | +} |
0 commit comments