aural-ui 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +456 -0
- package/dist/components/aspect-ratio/AspectRatio.stories.tsx +1327 -0
- package/dist/components/aspect-ratio/index.tsx +10 -0
- package/dist/components/aspect-ratio/meta.ts +8 -0
- package/dist/components/avatar/Avatar.stories.tsx +645 -0
- package/dist/components/avatar/index.tsx +50 -0
- package/dist/components/avatar/meta.ts +8 -0
- package/dist/components/badge/Badge.stories.tsx +169 -0
- package/dist/components/badge/index.tsx +28 -0
- package/dist/components/badge/meta.ts +6 -0
- package/dist/components/banner/Banner.stories.tsx +475 -0
- package/dist/components/banner/index.tsx +256 -0
- package/dist/components/banner/meta.ts +36 -0
- package/dist/components/button/Button.stories.tsx +74 -0
- package/dist/components/button/index.tsx +158 -0
- package/dist/components/button/meta.ts +33 -0
- package/dist/components/card/Card.stories.tsx +377 -0
- package/dist/components/card/index.tsx +85 -0
- package/dist/components/card/meta.ts +14 -0
- package/dist/components/char-count/CharCount.stories.tsx +334 -0
- package/dist/components/char-count/index.tsx +51 -0
- package/dist/components/char-count/meta.ts +13 -0
- package/dist/components/checkbox/Checkbox.stories.tsx +209 -0
- package/dist/components/checkbox/index.tsx +34 -0
- package/dist/components/checkbox/meta.ts +19 -0
- package/dist/components/chip/Chip.stories.tsx +207 -0
- package/dist/components/chip/index.tsx +92 -0
- package/dist/components/chip/meta.ts +17 -0
- package/dist/components/circular-loader/CircularLoader.stories.tsx +741 -0
- package/dist/components/circular-loader/index.tsx +138 -0
- package/dist/components/circular-loader/meta.ts +11 -0
- package/dist/components/collapsible/Collapsible.stories.tsx +319 -0
- package/dist/components/collapsible/index.tsx +158 -0
- package/dist/components/collapsible/meta.ts +22 -0
- package/dist/components/command/Command.stories.tsx +996 -0
- package/dist/components/command/index.tsx +324 -0
- package/dist/components/command/meta.ts +18 -0
- package/dist/components/dialog/Dialog.stories.tsx +963 -0
- package/dist/components/dialog/index.tsx +250 -0
- package/dist/components/dialog/meta.ts +28 -0
- package/dist/components/divider/Divider.stories.tsx +633 -0
- package/dist/components/divider/index.tsx +181 -0
- package/dist/components/divider/meta.ts +12 -0
- package/dist/components/dot-loader/DotLoader.stories.tsx +352 -0
- package/dist/components/dot-loader/index.tsx +78 -0
- package/dist/components/dot-loader/meta.ts +14 -0
- package/dist/components/dropdown/Dropdown.stories.tsx +1210 -0
- package/dist/components/dropdown/index.tsx +479 -0
- package/dist/components/dropdown/meta.ts +21 -0
- package/dist/components/form/Form.stories.tsx +320 -0
- package/dist/components/form/index.tsx +183 -0
- package/dist/components/form/meta.ts +11 -0
- package/dist/components/helper-text/HelperText.stories.tsx +254 -0
- package/dist/components/helper-text/index.tsx +102 -0
- package/dist/components/helper-text/meta.ts +18 -0
- package/dist/components/hover-card/HoverCard.stories.tsx +1328 -0
- package/dist/components/hover-card/index.tsx +42 -0
- package/dist/components/hover-card/meta.ts +12 -0
- package/dist/components/icon-button/IconButton.stories.tsx +252 -0
- package/dist/components/icon-button/index.tsx +130 -0
- package/dist/components/icon-button/meta.ts +20 -0
- package/dist/components/if-else/if-else.stories.tsx +100 -0
- package/dist/components/if-else/index.tsx +56 -0
- package/dist/components/if-else/meta.ts +6 -0
- package/dist/components/index.ts +70 -0
- package/dist/components/input/Input.stories.tsx +431 -0
- package/dist/components/input/index.tsx +487 -0
- package/dist/components/input/meta.ts +28 -0
- package/dist/components/label/Label.stories.tsx +200 -0
- package/dist/components/label/index.tsx +43 -0
- package/dist/components/label/meta.ts +14 -0
- package/dist/components/list/List.stories.tsx +963 -0
- package/dist/components/list/index.tsx +567 -0
- package/dist/components/list/meta.ts +24 -0
- package/dist/components/marquee/Marquee.stories.tsx +819 -0
- package/dist/components/marquee/index.tsx +107 -0
- package/dist/components/marquee/meta.ts +6 -0
- package/dist/components/overlay/Overlay.stories.tsx +954 -0
- package/dist/components/overlay/index.tsx +58 -0
- package/dist/components/overlay/meta.ts +10 -0
- package/dist/components/pagination/Pagination.stories.tsx +354 -0
- package/dist/components/pagination/index.tsx +455 -0
- package/dist/components/pagination/meta.ts +29 -0
- package/dist/components/popover/Popover.stories.tsx +1037 -0
- package/dist/components/popover/index.tsx +67 -0
- package/dist/components/popover/meta.ts +12 -0
- package/dist/components/radio/Radio.stories.tsx +146 -0
- package/dist/components/radio/index.tsx +41 -0
- package/dist/components/radio/meta.ts +19 -0
- package/dist/components/resizable/Resizable.stories.tsx +866 -0
- package/dist/components/resizable/index.tsx +55 -0
- package/dist/components/resizable/meta.ts +12 -0
- package/dist/components/scroll-area/ScrollArea.stories.tsx +1104 -0
- package/dist/components/scroll-area/index.tsx +55 -0
- package/dist/components/scroll-area/meta.ts +8 -0
- package/dist/components/search/Search.stories.tsx +678 -0
- package/dist/components/search/index.tsx +141 -0
- package/dist/components/search/meta.ts +6 -0
- package/dist/components/select/Select.stories.tsx +962 -0
- package/dist/components/select/index.tsx +512 -0
- package/dist/components/select/meta.ts +40 -0
- package/dist/components/sheet/Sheet.stories.tsx +1060 -0
- package/dist/components/sheet/index.tsx +440 -0
- package/dist/components/sheet/meta.ts +38 -0
- package/dist/components/skelton/Skelton.stories.tsx +859 -0
- package/dist/components/skelton/index.tsx +17 -0
- package/dist/components/skelton/meta.ts +6 -0
- package/dist/components/slider/Slider.stories.tsx +876 -0
- package/dist/components/slider/index.tsx +156 -0
- package/dist/components/slider/meta.ts +29 -0
- package/dist/components/stepper/Stepper.stories.tsx +639 -0
- package/dist/components/stepper/index.tsx +650 -0
- package/dist/components/stepper/meta.ts +19 -0
- package/dist/components/switch/Switch.stories.tsx +85 -0
- package/dist/components/switch/index.tsx +37 -0
- package/dist/components/switch/meta.ts +24 -0
- package/dist/components/switch-case/SwitchCase.stories.tsx +209 -0
- package/dist/components/switch-case/index.tsx +89 -0
- package/dist/components/switch-case/meta.ts +6 -0
- package/dist/components/table/Table.stories.tsx +1095 -0
- package/dist/components/table/index.tsx +113 -0
- package/dist/components/table/meta.ts +20 -0
- package/dist/components/tabs/Tabs.stories.tsx +1379 -0
- package/dist/components/tabs/index.tsx +186 -0
- package/dist/components/tabs/meta.ts +25 -0
- package/dist/components/tag/Tag.stories.tsx +625 -0
- package/dist/components/tag/index.tsx +320 -0
- package/dist/components/tag/meta.ts +52 -0
- package/dist/components/textarea/TextArea.stories.tsx +723 -0
- package/dist/components/textarea/index.tsx +480 -0
- package/dist/components/textarea/meta.ts +23 -0
- package/dist/components/toast/Toast.stories.tsx +1427 -0
- package/dist/components/toast/index.tsx +26 -0
- package/dist/components/toast/meta.ts +19 -0
- package/dist/components/toggle/Toggle.stories.tsx +1093 -0
- package/dist/components/toggle/index.tsx +44 -0
- package/dist/components/toggle/meta.ts +19 -0
- package/dist/components/tooltip/Tooltip.stories.tsx +1548 -0
- package/dist/components/tooltip/index.tsx +304 -0
- package/dist/components/tooltip/meta.ts +21 -0
- package/dist/components/typography/Typography.stories.tsx +197 -0
- package/dist/components/typography/index.tsx +184 -0
- package/dist/components/typography/meta.ts +38 -0
- package/dist/fonts/LabGrotesque-Regular.ttf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Bold.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Light.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Medium.otf +0 -0
- package/dist/fonts/LabGrotesqueTRIAL-Regular.otf +0 -0
- package/dist/fonts/PPSupplySans-Regular (1).otf +0 -0
- package/dist/fonts/PPSupplySans-Regular.otf +0 -0
- package/dist/fonts/PPSupplySans-Ultralight.otf +0 -0
- package/dist/hooks/index.ts +3 -0
- package/dist/hooks/use-previous/UsePrevious.stories.tsx +997 -0
- package/dist/hooks/use-previous/index.ts +15 -0
- package/dist/hooks/use-previous/meta.ts +6 -0
- package/dist/hooks/use-standalone-pagination/UseStandalonePagination.stories.tsx +983 -0
- package/dist/hooks/use-standalone-pagination/index.ts +146 -0
- package/dist/hooks/use-standalone-pagination/meta.ts +6 -0
- package/dist/icons/Icons.stories.tsx +29 -0
- package/dist/icons/alert-icon/AlertIcon.stories.tsx +991 -0
- package/dist/icons/alert-icon/index.tsx +48 -0
- package/dist/icons/alert-icon/meta.ts +8 -0
- package/dist/icons/all-icons.tsx +738 -0
- package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +1031 -0
- package/dist/icons/angle-down-icon/index.tsx +25 -0
- package/dist/icons/angle-down-icon/meta.ts +8 -0
- package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +1080 -0
- package/dist/icons/arrow-box-left-icon/index.tsx +24 -0
- package/dist/icons/arrow-box-left-icon/meta.ts +8 -0
- package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +1151 -0
- package/dist/icons/arrow-right-icon/index.tsx +26 -0
- package/dist/icons/arrow-right-icon/meta.ts +8 -0
- package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +1273 -0
- package/dist/icons/arrow-right-up-icon/index.tsx +24 -0
- package/dist/icons/arrow-right-up-icon/meta.ts +8 -0
- package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +670 -0
- package/dist/icons/art-board-icon/index.tsx +24 -0
- package/dist/icons/art-board-icon/meta.ts +7 -0
- package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +1244 -0
- package/dist/icons/audio-bar-icon/index.tsx +19 -0
- package/dist/icons/audio-bar-icon/meta.ts +8 -0
- package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +1239 -0
- package/dist/icons/bubble-check-icon/index.tsx +24 -0
- package/dist/icons/bubble-check-icon/meta.ts +8 -0
- package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +1228 -0
- package/dist/icons/bubble-crossed-icon/index.tsx +24 -0
- package/dist/icons/bubble-crossed-icon/meta.ts +8 -0
- package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +912 -0
- package/dist/icons/bubble-sparkle-icon/index.tsx +26 -0
- package/dist/icons/bubble-sparkle-icon/meta.ts +8 -0
- package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-double-left-icon/index.tsx +34 -0
- package/dist/icons/chevron-double-left-icon/meta.ts +8 -0
- package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-double-right-icon/index.tsx +34 -0
- package/dist/icons/chevron-double-right-icon/meta.ts +8 -0
- package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +1001 -0
- package/dist/icons/chevron-down-icon/index.tsx +27 -0
- package/dist/icons/chevron-down-icon/meta.ts +8 -0
- package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +1029 -0
- package/dist/icons/chevron-left-icon/index.tsx +27 -0
- package/dist/icons/chevron-left-icon/meta.ts +8 -0
- package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +1021 -0
- package/dist/icons/chevron-right-icon/index.tsx +27 -0
- package/dist/icons/chevron-right-icon/meta.ts +8 -0
- package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +1036 -0
- package/dist/icons/chevron-up-icon/index.tsx +27 -0
- package/dist/icons/chevron-up-icon/meta.ts +8 -0
- package/dist/icons/command-icon/CommandIcon.stories.tsx +1098 -0
- package/dist/icons/command-icon/index.tsx +24 -0
- package/dist/icons/command-icon/meta.ts +8 -0
- package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +1061 -0
- package/dist/icons/cross-circle-icon/index.tsx +23 -0
- package/dist/icons/cross-circle-icon/meta.ts +8 -0
- package/dist/icons/cross-icon/CrossIcon.stories.tsx +1027 -0
- package/dist/icons/cross-icon/index.tsx +24 -0
- package/dist/icons/cross-icon/meta.ts +8 -0
- package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +1092 -0
- package/dist/icons/edit-big-icon/index.tsx +22 -0
- package/dist/icons/edit-big-icon/meta.ts +8 -0
- package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +1090 -0
- package/dist/icons/eye-close-icon/index.tsx +26 -0
- package/dist/icons/eye-close-icon/meta.ts +8 -0
- package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +1098 -0
- package/dist/icons/eye-open-icon/index.tsx +24 -0
- package/dist/icons/eye-open-icon/meta.ts +8 -0
- package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +1071 -0
- package/dist/icons/feature-shine-icon/index.tsx +29 -0
- package/dist/icons/feature-shine-icon/meta.ts +8 -0
- package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +1115 -0
- package/dist/icons/file-chart-icon/index.tsx +24 -0
- package/dist/icons/file-chart-icon/meta.ts +8 -0
- package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +668 -0
- package/dist/icons/file-text-icon/index.tsx +24 -0
- package/dist/icons/file-text-icon/meta.ts +8 -0
- package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +1239 -0
- package/dist/icons/grip-vertical-icon/index.tsx +28 -0
- package/dist/icons/grip-vertical-icon/meta.ts +8 -0
- package/dist/icons/image-icon/ImageIcon.stories.tsx +1181 -0
- package/dist/icons/image-icon/index.tsx +24 -0
- package/dist/icons/image-icon/meta.ts +8 -0
- package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +1248 -0
- package/dist/icons/import-folder-icon/index.tsx +22 -0
- package/dist/icons/import-folder-icon/meta.ts +8 -0
- package/dist/icons/index.ts +46 -0
- package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +1272 -0
- package/dist/icons/light-bulb-simple-icon/index.tsx +24 -0
- package/dist/icons/light-bulb-simple-icon/meta.ts +8 -0
- package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +1245 -0
- package/dist/icons/magic-book-icon/index.tsx +32 -0
- package/dist/icons/magic-book-icon/meta.ts +8 -0
- package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +1251 -0
- package/dist/icons/maintenance-icon/index.tsx +23 -0
- package/dist/icons/maintenance-icon/meta.ts +8 -0
- package/dist/icons/message-icon/MessageIcon.stories.tsx +595 -0
- package/dist/icons/message-icon/index.tsx +30 -0
- package/dist/icons/message-icon/meta.ts +8 -0
- package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +1245 -0
- package/dist/icons/move-horizontal-icon/index.tsx +23 -0
- package/dist/icons/move-horizontal-icon/meta.ts +8 -0
- package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +1196 -0
- package/dist/icons/move-vertical-icon/index.tsx +23 -0
- package/dist/icons/move-vertical-icon/meta.ts +8 -0
- package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +1167 -0
- package/dist/icons/page-search-icon/index.tsx +21 -0
- package/dist/icons/page-search-icon/meta.ts +8 -0
- package/dist/icons/pencil-icon/PencilIcon.stories.tsx +1131 -0
- package/dist/icons/pencil-icon/index.tsx +21 -0
- package/dist/icons/pencil-icon/meta.ts +8 -0
- package/dist/icons/plus-icon/PlusIcon.stories.tsx +1151 -0
- package/dist/icons/plus-icon/index.tsx +24 -0
- package/dist/icons/plus-icon/meta.ts +8 -0
- package/dist/icons/search-icon/SearchIcon.stories.tsx +1181 -0
- package/dist/icons/search-icon/index.tsx +24 -0
- package/dist/icons/search-icon/meta.ts +8 -0
- package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +1167 -0
- package/dist/icons/site-logo-icon/index.tsx +79 -0
- package/dist/icons/site-logo-icon/meta.ts +8 -0
- package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +637 -0
- package/dist/icons/spinner-gradient-icon/index.tsx +53 -0
- package/dist/icons/spinner-gradient-icon/meta.ts +8 -0
- package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +644 -0
- package/dist/icons/spinner-solid-icon/index.tsx +59 -0
- package/dist/icons/spinner-solid-icon/meta.ts +8 -0
- package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +736 -0
- package/dist/icons/spinner-solid-neutral-icon/index.tsx +53 -0
- package/dist/icons/spinner-solid-neutral-icon/meta.ts +8 -0
- package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +1204 -0
- package/dist/icons/tick-circle-icon/index.tsx +23 -0
- package/dist/icons/tick-circle-icon/meta.ts +8 -0
- package/dist/icons/tick-icon/TickIcon.stories.tsx +1340 -0
- package/dist/icons/tick-icon/index.tsx +24 -0
- package/dist/icons/tick-icon/meta.ts +8 -0
- package/dist/icons/trash-icon/TrashIcon.stories.tsx +996 -0
- package/dist/icons/trash-icon/index.tsx +24 -0
- package/dist/icons/trash-icon/meta.ts +8 -0
- package/dist/icons/upload-icon/UploadIcon.stories.tsx +947 -0
- package/dist/icons/upload-icon/index.tsx +24 -0
- package/dist/icons/upload-icon/meta.ts +8 -0
- package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +1045 -0
- package/dist/icons/vertical-menu-icon/index.tsx +27 -0
- package/dist/icons/vertical-menu-icon/meta.ts +8 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +206 -0
- package/dist/lib/utils.ts +6 -0
- package/dist/styles/aural-theme.css +1008 -0
- package/package.json +142 -0
|
@@ -0,0 +1,1327 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
|
|
4
|
+
import { AspectRatio } from "."
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof AspectRatio> = {
|
|
7
|
+
title: "Components/UI/AspectRatio",
|
|
8
|
+
component: AspectRatio,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "fullscreen",
|
|
11
|
+
backgrounds: {
|
|
12
|
+
default: "dark",
|
|
13
|
+
values: [
|
|
14
|
+
{ name: "dark", value: "#0a0a0a" },
|
|
15
|
+
{ name: "darker", value: "#000000" },
|
|
16
|
+
{ name: "light", value: "#ffffff" },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
docs: {
|
|
20
|
+
page: () => (
|
|
21
|
+
<>
|
|
22
|
+
{/* Override default docs styling */}
|
|
23
|
+
<style>
|
|
24
|
+
{`
|
|
25
|
+
.sbdocs-wrapper {
|
|
26
|
+
padding: 0 !important;
|
|
27
|
+
max-width: none !important;
|
|
28
|
+
background: transparent !important;
|
|
29
|
+
}
|
|
30
|
+
.sbdocs-content {
|
|
31
|
+
max-width: none !important;
|
|
32
|
+
padding: 0 !important;
|
|
33
|
+
margin: 0 !important;
|
|
34
|
+
background: transparent !important;
|
|
35
|
+
}
|
|
36
|
+
.docs-story {
|
|
37
|
+
background: transparent !important;
|
|
38
|
+
}
|
|
39
|
+
.sbdocs {
|
|
40
|
+
background: transparent !important;
|
|
41
|
+
}
|
|
42
|
+
body {
|
|
43
|
+
background: #0a0a0a !important;
|
|
44
|
+
}
|
|
45
|
+
#storybook-docs {
|
|
46
|
+
background: #0a0a0a !important;
|
|
47
|
+
}
|
|
48
|
+
.sbdocs-preview {
|
|
49
|
+
background: transparent !important;
|
|
50
|
+
border: none !important;
|
|
51
|
+
}
|
|
52
|
+
.sbdocs-h1, .sbdocs-h2, .sbdocs-h3, .sbdocs-h4, .sbdocs-h5, .sbdocs-h6 {
|
|
53
|
+
color: white !important;
|
|
54
|
+
}
|
|
55
|
+
.sbdocs-p, .sbdocs-li {
|
|
56
|
+
color: rgba(255, 255, 255, 0.7) !important;
|
|
57
|
+
}
|
|
58
|
+
.sbdocs-code {
|
|
59
|
+
background: rgba(255, 255, 255, 0.1) !important;
|
|
60
|
+
color: rgba(168, 85, 247, 1) !important;
|
|
61
|
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
|
62
|
+
}
|
|
63
|
+
.sbdocs-pre {
|
|
64
|
+
background: rgba(0, 0, 0, 0.4) !important;
|
|
65
|
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
|
66
|
+
}
|
|
67
|
+
.sbdocs-table {
|
|
68
|
+
background: rgba(255, 255, 255, 0.05) !important;
|
|
69
|
+
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
|
70
|
+
}
|
|
71
|
+
.sbdocs-table th {
|
|
72
|
+
background: rgba(255, 255, 255, 0.05) !important;
|
|
73
|
+
color: white !important;
|
|
74
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
|
|
75
|
+
}
|
|
76
|
+
.sbdocs-table td {
|
|
77
|
+
color: rgba(255, 255, 255, 0.7) !important;
|
|
78
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
|
|
79
|
+
}
|
|
80
|
+
`}
|
|
81
|
+
</style>
|
|
82
|
+
|
|
83
|
+
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900/20 to-gray-900">
|
|
84
|
+
{/* Header */}
|
|
85
|
+
<div className="relative overflow-hidden border-b border-white/10 bg-black/20 backdrop-blur-xl">
|
|
86
|
+
<div className="absolute inset-0 bg-gradient-to-r from-purple-500/10 via-transparent to-blue-500/10" />
|
|
87
|
+
<div className="relative !mx-auto max-w-7xl px-6 py-16">
|
|
88
|
+
<div className="!space-y-6 text-center">
|
|
89
|
+
<h1 className="!text-white">AspectRatio</h1>
|
|
90
|
+
<p className="!mx-auto max-w-3xl text-xl leading-relaxed !text-white">
|
|
91
|
+
A utility component for maintaining consistent aspect ratios
|
|
92
|
+
across different content types and screen sizes. Built on
|
|
93
|
+
Radix UI primitives for reliability and accessibility.
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
{/* Stats */}
|
|
97
|
+
<div className="flex items-center justify-center gap-8 pt-8">
|
|
98
|
+
<div className="text-center">
|
|
99
|
+
<div className="text-3xl font-bold text-purple-300">
|
|
100
|
+
Responsive
|
|
101
|
+
</div>
|
|
102
|
+
<div className="text-sm text-white/80">
|
|
103
|
+
Adapts to container
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
<div className="h-8 w-px bg-white/20" />
|
|
107
|
+
<div className="text-center">
|
|
108
|
+
<div className="text-3xl font-bold text-blue-300">
|
|
109
|
+
Flexible
|
|
110
|
+
</div>
|
|
111
|
+
<div className="text-sm text-white/80">
|
|
112
|
+
Any content type
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div className="h-8 w-px bg-white/20" />
|
|
116
|
+
<div className="text-center">
|
|
117
|
+
<div className="text-3xl font-bold text-green-300">
|
|
118
|
+
Consistent
|
|
119
|
+
</div>
|
|
120
|
+
<div className="text-sm text-white/80">
|
|
121
|
+
Maintains ratio
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{/* Content */}
|
|
130
|
+
<div className="!mx-auto max-w-7xl !space-y-16 px-6 py-12">
|
|
131
|
+
{/* Features */}
|
|
132
|
+
<div className="!space-y-8">
|
|
133
|
+
<h3 className="text-center text-2xl font-bold !text-white">
|
|
134
|
+
Key Features
|
|
135
|
+
</h3>
|
|
136
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
137
|
+
<div className="space-y-4 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
138
|
+
<div className="text-3xl">📐</div>
|
|
139
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
140
|
+
Consistent Ratios
|
|
141
|
+
</h4>
|
|
142
|
+
<p className="text-sm !text-white/80">
|
|
143
|
+
Maintains specified aspect ratios regardless of container
|
|
144
|
+
size changes
|
|
145
|
+
</p>
|
|
146
|
+
</div>
|
|
147
|
+
<div className="space-y-4 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
148
|
+
<div className="text-3xl">📱</div>
|
|
149
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
150
|
+
Responsive Design
|
|
151
|
+
</h4>
|
|
152
|
+
<p className="text-sm !text-white/80">
|
|
153
|
+
Adapts to parent container while preserving aspect ratio
|
|
154
|
+
</p>
|
|
155
|
+
</div>
|
|
156
|
+
<div className="space-y-4 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
157
|
+
<div className="text-3xl">🎨</div>
|
|
158
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
159
|
+
Flexible Content
|
|
160
|
+
</h4>
|
|
161
|
+
<p className="text-sm !text-white/80">
|
|
162
|
+
Works with images, videos, iframes, and any custom content
|
|
163
|
+
</p>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
{/* API Reference */}
|
|
169
|
+
<div className="!space-y-8">
|
|
170
|
+
<h3 className="text-center text-2xl font-bold !text-white">
|
|
171
|
+
API Reference
|
|
172
|
+
</h3>
|
|
173
|
+
|
|
174
|
+
{/* Component Signature */}
|
|
175
|
+
<div className="rounded-lg border border-white/10 bg-white/5 p-6">
|
|
176
|
+
<h4 className="mb-4 text-lg font-semibold !text-purple-300">
|
|
177
|
+
Component Signature
|
|
178
|
+
</h4>
|
|
179
|
+
<div className="rounded-lg bg-black/40 p-4">
|
|
180
|
+
<pre className="text-sm !text-blue-300">
|
|
181
|
+
{`import { AspectRatio } from "@/components/ui/aspect-ratio"
|
|
182
|
+
|
|
183
|
+
<AspectRatio ratio={16 / 9}>
|
|
184
|
+
{/* Your content */}
|
|
185
|
+
</AspectRatio>`}
|
|
186
|
+
</pre>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
{/* Props Table */}
|
|
191
|
+
<div className="overflow-hidden rounded-lg border border-white/10 bg-white/5">
|
|
192
|
+
<div className="bg-white/5 p-4">
|
|
193
|
+
<h4 className="text-lg font-semibold !text-white">Props</h4>
|
|
194
|
+
</div>
|
|
195
|
+
<table className="!my-0 w-full">
|
|
196
|
+
<thead className="bg-white/5">
|
|
197
|
+
<tr className="border-b border-white/10">
|
|
198
|
+
<th className="px-6 py-4 text-left text-sm font-semibold !text-white">
|
|
199
|
+
Prop
|
|
200
|
+
</th>
|
|
201
|
+
<th className="px-6 py-4 text-left text-sm font-semibold !text-white">
|
|
202
|
+
Type
|
|
203
|
+
</th>
|
|
204
|
+
<th className="px-6 py-4 text-left text-sm font-semibold !text-white">
|
|
205
|
+
Default
|
|
206
|
+
</th>
|
|
207
|
+
<th className="px-6 py-4 text-left text-sm font-semibold !text-white">
|
|
208
|
+
Description
|
|
209
|
+
</th>
|
|
210
|
+
</tr>
|
|
211
|
+
</thead>
|
|
212
|
+
<tbody>
|
|
213
|
+
<tr className="border-b border-white/5">
|
|
214
|
+
<td className="px-6 py-4 font-mono text-sm !text-purple-300">
|
|
215
|
+
ratio
|
|
216
|
+
</td>
|
|
217
|
+
<td className="px-6 py-4 text-sm !text-white/80">
|
|
218
|
+
number
|
|
219
|
+
</td>
|
|
220
|
+
<td className="px-6 py-4 text-sm !text-white/60">1</td>
|
|
221
|
+
<td className="px-6 py-4 text-sm !text-white/80">
|
|
222
|
+
The desired aspect ratio (width / height)
|
|
223
|
+
</td>
|
|
224
|
+
</tr>
|
|
225
|
+
<tr className="border-b border-white/5 !bg-transparent">
|
|
226
|
+
<td className="px-6 py-4 font-mono text-sm !text-purple-300">
|
|
227
|
+
children
|
|
228
|
+
</td>
|
|
229
|
+
<td className="px-6 py-4 text-sm !text-white/80">
|
|
230
|
+
ReactNode
|
|
231
|
+
</td>
|
|
232
|
+
<td className="px-6 py-4 text-sm !text-white/60">-</td>
|
|
233
|
+
<td className="px-6 py-4 text-sm !text-white/80">
|
|
234
|
+
Content to maintain aspect ratio for
|
|
235
|
+
</td>
|
|
236
|
+
</tr>
|
|
237
|
+
<tr>
|
|
238
|
+
<td className="px-6 py-4 font-mono text-sm !text-purple-300">
|
|
239
|
+
className
|
|
240
|
+
</td>
|
|
241
|
+
<td className="px-6 py-4 text-sm !text-white/80">
|
|
242
|
+
string
|
|
243
|
+
</td>
|
|
244
|
+
<td className="px-6 py-4 text-sm !text-white/60">-</td>
|
|
245
|
+
<td className="px-6 py-4 text-sm !text-white/80">
|
|
246
|
+
Additional CSS classes
|
|
247
|
+
</td>
|
|
248
|
+
</tr>
|
|
249
|
+
</tbody>
|
|
250
|
+
</table>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
{/* Usage Examples */}
|
|
255
|
+
<div className="!space-y-8">
|
|
256
|
+
<h3 className="text-center text-2xl font-bold !text-white">
|
|
257
|
+
Usage Examples
|
|
258
|
+
</h3>
|
|
259
|
+
|
|
260
|
+
<div className="grid grid-cols-1 gap-8 lg:grid-cols-2">
|
|
261
|
+
<div className="space-y-4">
|
|
262
|
+
<h4 className="text-lg font-semibold !text-purple-300">
|
|
263
|
+
Basic Image
|
|
264
|
+
</h4>
|
|
265
|
+
<div className="rounded-lg bg-black/40 p-4">
|
|
266
|
+
<pre className="overflow-x-auto text-sm !text-green-300">
|
|
267
|
+
{`<AspectRatio ratio={16 / 9}>
|
|
268
|
+
<img
|
|
269
|
+
src="/image.jpg"
|
|
270
|
+
alt="Description"
|
|
271
|
+
className="h-full w-full object-cover"
|
|
272
|
+
/>
|
|
273
|
+
</AspectRatio>`}
|
|
274
|
+
</pre>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<div className="space-y-4">
|
|
279
|
+
<h4 className="text-lg font-semibold !text-purple-300">
|
|
280
|
+
Video Embed
|
|
281
|
+
</h4>
|
|
282
|
+
<div className="rounded-lg bg-black/40 p-4">
|
|
283
|
+
<pre className="overflow-x-auto text-sm !text-blue-300">
|
|
284
|
+
{`<AspectRatio ratio={16 / 9}>
|
|
285
|
+
<iframe
|
|
286
|
+
src="https://www.youtube.com/embed/..."
|
|
287
|
+
className="h-full w-full"
|
|
288
|
+
/>
|
|
289
|
+
</AspectRatio>`}
|
|
290
|
+
</pre>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<div className="space-y-4">
|
|
295
|
+
<h4 className="text-lg font-semibold !text-purple-300">
|
|
296
|
+
Custom Content
|
|
297
|
+
</h4>
|
|
298
|
+
<div className="rounded-lg bg-black/40 p-4">
|
|
299
|
+
<pre className="overflow-x-auto text-sm !text-orange-300">
|
|
300
|
+
{`<AspectRatio ratio={1}>
|
|
301
|
+
<div className="flex h-full w-full items-center
|
|
302
|
+
justify-center bg-gradient-to-br
|
|
303
|
+
from-blue-500 to-purple-600">
|
|
304
|
+
<h3 className="text-white">Square Content</h3>
|
|
305
|
+
</div>
|
|
306
|
+
</AspectRatio>`}
|
|
307
|
+
</pre>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div className="space-y-4">
|
|
312
|
+
<h4 className="text-lg font-semibold !text-purple-300">
|
|
313
|
+
Common Ratios
|
|
314
|
+
</h4>
|
|
315
|
+
<div className="rounded-lg bg-black/40 p-4">
|
|
316
|
+
<pre className="overflow-x-auto text-sm !text-pink-300">
|
|
317
|
+
{`// Common aspect ratios
|
|
318
|
+
16/9 // Widescreen, video
|
|
319
|
+
4/3 // Traditional, photo
|
|
320
|
+
1 // Square, profile pics
|
|
321
|
+
3/2 // Photography
|
|
322
|
+
21/9 // Ultra-wide
|
|
323
|
+
9/16 // Portrait, mobile`}
|
|
324
|
+
</pre>
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
</div>
|
|
329
|
+
|
|
330
|
+
{/* Common Ratios Visual Guide */}
|
|
331
|
+
<div className="!space-y-8">
|
|
332
|
+
<h3 className="text-center text-2xl font-bold !text-white">
|
|
333
|
+
Common Aspect Ratios
|
|
334
|
+
</h3>
|
|
335
|
+
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6">
|
|
336
|
+
{[
|
|
337
|
+
{
|
|
338
|
+
ratio: 1,
|
|
339
|
+
label: "1:1",
|
|
340
|
+
name: "Square",
|
|
341
|
+
color: "from-purple-500 to-pink-500",
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
ratio: 16 / 9,
|
|
345
|
+
label: "16:9",
|
|
346
|
+
name: "Widescreen",
|
|
347
|
+
color: "from-blue-500 to-cyan-500",
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
ratio: 4 / 3,
|
|
351
|
+
label: "4:3",
|
|
352
|
+
name: "Traditional",
|
|
353
|
+
color: "from-green-500 to-emerald-500",
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
ratio: 3 / 2,
|
|
357
|
+
label: "3:2",
|
|
358
|
+
name: "Photography",
|
|
359
|
+
color: "from-orange-500 to-red-500",
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
ratio: 21 / 9,
|
|
363
|
+
label: "21:9",
|
|
364
|
+
name: "Ultra-wide",
|
|
365
|
+
color: "from-indigo-500 to-purple-500",
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
ratio: 9 / 16,
|
|
369
|
+
label: "9:16",
|
|
370
|
+
name: "Portrait",
|
|
371
|
+
color: "from-pink-500 to-rose-500",
|
|
372
|
+
},
|
|
373
|
+
].map((item) => (
|
|
374
|
+
<div key={item.label} className="space-y-3">
|
|
375
|
+
<AspectRatio ratio={item.ratio}>
|
|
376
|
+
<div
|
|
377
|
+
className={`flex h-full w-full items-center justify-center rounded-lg bg-gradient-to-br ${item.color} text-white shadow-lg`}
|
|
378
|
+
>
|
|
379
|
+
<div className="text-center">
|
|
380
|
+
<div className="text-sm font-bold">
|
|
381
|
+
{item.label}
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
</AspectRatio>
|
|
386
|
+
<div className="text-center">
|
|
387
|
+
<div className="text-sm font-medium text-white">
|
|
388
|
+
{item.name}
|
|
389
|
+
</div>
|
|
390
|
+
<div className="text-xs text-white/60">
|
|
391
|
+
{item.label}
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
))}
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
|
|
399
|
+
{/* Use Cases */}
|
|
400
|
+
<div className="!space-y-8">
|
|
401
|
+
<h3 className="text-center text-2xl font-bold !text-white">
|
|
402
|
+
Common Use Cases
|
|
403
|
+
</h3>
|
|
404
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
405
|
+
<div className="space-y-3 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
406
|
+
<div className="text-2xl">🖼️</div>
|
|
407
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
408
|
+
Image Galleries
|
|
409
|
+
</h4>
|
|
410
|
+
<p className="text-sm !text-white/80">
|
|
411
|
+
Consistent thumbnail sizes across different image
|
|
412
|
+
dimensions
|
|
413
|
+
</p>
|
|
414
|
+
</div>
|
|
415
|
+
<div className="space-y-3 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
416
|
+
<div className="text-2xl">🎬</div>
|
|
417
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
418
|
+
Video Players
|
|
419
|
+
</h4>
|
|
420
|
+
<p className="text-sm !text-white/80">
|
|
421
|
+
Standard video aspect ratios like 16:9 and 4:3
|
|
422
|
+
</p>
|
|
423
|
+
</div>
|
|
424
|
+
<div className="space-y-3 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
425
|
+
<div className="text-2xl">🃏</div>
|
|
426
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
427
|
+
Card Layouts
|
|
428
|
+
</h4>
|
|
429
|
+
<p className="text-sm !text-white/80">
|
|
430
|
+
Uniform card dimensions for consistent grid layouts
|
|
431
|
+
</p>
|
|
432
|
+
</div>
|
|
433
|
+
<div className="space-y-3 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
434
|
+
<div className="text-2xl">📺</div>
|
|
435
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
436
|
+
Media Embeds
|
|
437
|
+
</h4>
|
|
438
|
+
<p className="text-sm !text-white/80">
|
|
439
|
+
YouTube, Vimeo, and social media embeds
|
|
440
|
+
</p>
|
|
441
|
+
</div>
|
|
442
|
+
<div className="space-y-3 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
443
|
+
<div className="text-2xl">🛍️</div>
|
|
444
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
445
|
+
Product Images
|
|
446
|
+
</h4>
|
|
447
|
+
<p className="text-sm !text-white/80">
|
|
448
|
+
E-commerce product displays with consistent sizing
|
|
449
|
+
</p>
|
|
450
|
+
</div>
|
|
451
|
+
<div className="space-y-3 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
452
|
+
<div className="text-2xl">👤</div>
|
|
453
|
+
<h4 className="text-lg font-semibold !text-white">
|
|
454
|
+
Profile Pictures
|
|
455
|
+
</h4>
|
|
456
|
+
<p className="text-sm !text-white/80">
|
|
457
|
+
Square avatar containers for user profiles
|
|
458
|
+
</p>
|
|
459
|
+
</div>
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
462
|
+
|
|
463
|
+
{/* Best Practices */}
|
|
464
|
+
<div className="!space-y-8">
|
|
465
|
+
<h3 className="text-center text-2xl font-bold !text-white">
|
|
466
|
+
Best Practices
|
|
467
|
+
</h3>
|
|
468
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
469
|
+
<div className="space-y-4 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
470
|
+
<h4 className="text-lg font-semibold !text-green-300">
|
|
471
|
+
✅ Do
|
|
472
|
+
</h4>
|
|
473
|
+
<ul className="space-y-2 text-sm !text-white/80">
|
|
474
|
+
<li className="!text-white/80">
|
|
475
|
+
Use consistent ratios across similar content types
|
|
476
|
+
</li>
|
|
477
|
+
<li className="!text-white/80">
|
|
478
|
+
Choose ratios that match your content's natural
|
|
479
|
+
proportions
|
|
480
|
+
</li>
|
|
481
|
+
<li className="!text-white/80">
|
|
482
|
+
Apply object-fit: cover for images to maintain quality
|
|
483
|
+
</li>
|
|
484
|
+
<li className="!text-white/80">
|
|
485
|
+
Test ratios across different screen sizes
|
|
486
|
+
</li>
|
|
487
|
+
<li className="!text-white/80">
|
|
488
|
+
Use semantic aspect ratios (16:9 for video, 1:1 for
|
|
489
|
+
avatars)
|
|
490
|
+
</li>
|
|
491
|
+
</ul>
|
|
492
|
+
</div>
|
|
493
|
+
<div className="space-y-4 rounded-lg border border-white/10 bg-white/5 p-6">
|
|
494
|
+
<h4 className="text-lg font-semibold !text-red-300">
|
|
495
|
+
❌ Don't
|
|
496
|
+
</h4>
|
|
497
|
+
<ul className="space-y-2 text-sm !text-white/80">
|
|
498
|
+
<li className="!text-white/80">
|
|
499
|
+
Mix different ratios in the same content grid
|
|
500
|
+
</li>
|
|
501
|
+
<li className="!text-white/80">
|
|
502
|
+
Use extreme ratios that distort content
|
|
503
|
+
</li>
|
|
504
|
+
<li className="!text-white/80">
|
|
505
|
+
Forget to handle different content types gracefully
|
|
506
|
+
</li>
|
|
507
|
+
<li className="!text-white/80">
|
|
508
|
+
Ignore responsive behavior on mobile devices
|
|
509
|
+
</li>
|
|
510
|
+
<li className="!text-white/80">
|
|
511
|
+
Use ratios that don't match platform conventions
|
|
512
|
+
</li>
|
|
513
|
+
</ul>
|
|
514
|
+
</div>
|
|
515
|
+
</div>
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
|
|
519
|
+
{/* Footer */}
|
|
520
|
+
<div className="border-t border-white/10 bg-black/20 backdrop-blur-xl">
|
|
521
|
+
<div className="!mx-auto max-w-7xl px-6 py-8">
|
|
522
|
+
<div className="space-y-4 text-center">
|
|
523
|
+
<p className="!text-white/60">
|
|
524
|
+
AspectRatio component built on Radix UI primitives for
|
|
525
|
+
reliability and accessibility.
|
|
526
|
+
</p>
|
|
527
|
+
<p className="text-sm !text-white/40">
|
|
528
|
+
Maintains consistent aspect ratios while being fully
|
|
529
|
+
responsive and flexible.
|
|
530
|
+
</p>
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
</>
|
|
536
|
+
),
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
tags: ["autodocs"],
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export default meta
|
|
543
|
+
type Story = StoryObj<typeof AspectRatio>
|
|
544
|
+
|
|
545
|
+
// All stories should also have dark backgrounds
|
|
546
|
+
const storyParameters = {
|
|
547
|
+
backgrounds: {
|
|
548
|
+
default: "dark",
|
|
549
|
+
values: [
|
|
550
|
+
{ name: "dark", value: "#0a0a0a" },
|
|
551
|
+
{ name: "darker", value: "#000000" },
|
|
552
|
+
],
|
|
553
|
+
},
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// 1. Common Aspect Ratios
|
|
557
|
+
export const CommonRatios: Story = {
|
|
558
|
+
render: () => (
|
|
559
|
+
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900/10 to-gray-900 p-8">
|
|
560
|
+
<div className="mx-auto max-w-7xl space-y-12">
|
|
561
|
+
<div className="text-center">
|
|
562
|
+
<h3 className="mb-4 bg-gradient-to-r from-white via-purple-200 to-white bg-clip-text text-3xl font-bold text-transparent">
|
|
563
|
+
Common Aspect Ratios
|
|
564
|
+
</h3>
|
|
565
|
+
<p className="mx-auto max-w-2xl text-lg text-white/80">
|
|
566
|
+
Standard aspect ratios for different content types, each optimized
|
|
567
|
+
for specific use cases
|
|
568
|
+
</p>
|
|
569
|
+
</div>
|
|
570
|
+
|
|
571
|
+
<div className="grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-3">
|
|
572
|
+
{/* Square - 1:1 */}
|
|
573
|
+
<div className="group space-y-4">
|
|
574
|
+
<div className="mx-auto w-full max-w-sm">
|
|
575
|
+
<AspectRatio ratio={1}>
|
|
576
|
+
<div className="flex h-full w-full items-center justify-center rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 text-white shadow-xl transition-transform duration-300 group-hover:scale-105">
|
|
577
|
+
<div className="text-center">
|
|
578
|
+
<div className="text-2xl font-bold">1:1</div>
|
|
579
|
+
<div className="text-sm opacity-80">Square</div>
|
|
580
|
+
</div>
|
|
581
|
+
</div>
|
|
582
|
+
</AspectRatio>
|
|
583
|
+
</div>
|
|
584
|
+
<div className="text-center">
|
|
585
|
+
<h4 className="text-lg font-semibold text-white">Square (1:1)</h4>
|
|
586
|
+
<p className="text-sm text-white/60">
|
|
587
|
+
Profile pictures, avatars, social media posts
|
|
588
|
+
</p>
|
|
589
|
+
</div>
|
|
590
|
+
</div>
|
|
591
|
+
|
|
592
|
+
{/* Video - 16:9 */}
|
|
593
|
+
<div className="group space-y-4">
|
|
594
|
+
<div className="mx-auto w-full max-w-sm">
|
|
595
|
+
<AspectRatio ratio={16 / 9}>
|
|
596
|
+
<div className="flex h-full w-full items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-cyan-500 text-white shadow-xl transition-transform duration-300 group-hover:scale-105">
|
|
597
|
+
<div className="text-center">
|
|
598
|
+
<div className="text-2xl font-bold">16:9</div>
|
|
599
|
+
<div className="text-sm opacity-80">Widescreen</div>
|
|
600
|
+
</div>
|
|
601
|
+
</div>
|
|
602
|
+
</AspectRatio>
|
|
603
|
+
</div>
|
|
604
|
+
<div className="text-center">
|
|
605
|
+
<h4 className="text-lg font-semibold text-white">
|
|
606
|
+
Widescreen (16:9)
|
|
607
|
+
</h4>
|
|
608
|
+
<p className="text-sm text-white/60">
|
|
609
|
+
Videos, presentations, modern displays
|
|
610
|
+
</p>
|
|
611
|
+
</div>
|
|
612
|
+
</div>
|
|
613
|
+
|
|
614
|
+
{/* Traditional - 4:3 */}
|
|
615
|
+
<div className="group space-y-4">
|
|
616
|
+
<div className="mx-auto w-full max-w-sm">
|
|
617
|
+
<AspectRatio ratio={4 / 3}>
|
|
618
|
+
<div className="flex h-full w-full items-center justify-center rounded-lg bg-gradient-to-br from-green-500 to-emerald-500 text-white shadow-xl transition-transform duration-300 group-hover:scale-105">
|
|
619
|
+
<div className="text-center">
|
|
620
|
+
<div className="text-2xl font-bold">4:3</div>
|
|
621
|
+
<div className="text-sm opacity-80">Traditional</div>
|
|
622
|
+
</div>
|
|
623
|
+
</div>
|
|
624
|
+
</AspectRatio>
|
|
625
|
+
</div>
|
|
626
|
+
<div className="text-center">
|
|
627
|
+
<h4 className="text-lg font-semibold text-white">
|
|
628
|
+
Traditional (4:3)
|
|
629
|
+
</h4>
|
|
630
|
+
<p className="text-sm text-white/60">
|
|
631
|
+
Classic photos, old TV format
|
|
632
|
+
</p>
|
|
633
|
+
</div>
|
|
634
|
+
</div>
|
|
635
|
+
|
|
636
|
+
{/* Photo - 3:2 */}
|
|
637
|
+
<div className="group space-y-4">
|
|
638
|
+
<div className="mx-auto w-full max-w-sm">
|
|
639
|
+
<AspectRatio ratio={3 / 2}>
|
|
640
|
+
<div className="flex h-full w-full items-center justify-center rounded-lg bg-gradient-to-br from-orange-500 to-red-500 text-white shadow-xl transition-transform duration-300 group-hover:scale-105">
|
|
641
|
+
<div className="text-center">
|
|
642
|
+
<div className="text-2xl font-bold">3:2</div>
|
|
643
|
+
<div className="text-sm opacity-80">Photography</div>
|
|
644
|
+
</div>
|
|
645
|
+
</div>
|
|
646
|
+
</AspectRatio>
|
|
647
|
+
</div>
|
|
648
|
+
<div className="text-center">
|
|
649
|
+
<h4 className="text-lg font-semibold text-white">
|
|
650
|
+
Photography (3:2)
|
|
651
|
+
</h4>
|
|
652
|
+
<p className="text-sm text-white/60">35mm film, DSLR cameras</p>
|
|
653
|
+
</div>
|
|
654
|
+
</div>
|
|
655
|
+
|
|
656
|
+
{/* Ultra-wide - 21:9 */}
|
|
657
|
+
<div className="group space-y-4">
|
|
658
|
+
<div className="mx-auto w-full max-w-sm">
|
|
659
|
+
<AspectRatio ratio={21 / 9}>
|
|
660
|
+
<div className="flex h-full w-full items-center justify-center rounded-lg bg-gradient-to-br from-indigo-500 to-purple-500 text-white shadow-xl transition-transform duration-300 group-hover:scale-105">
|
|
661
|
+
<div className="text-center">
|
|
662
|
+
<div className="text-2xl font-bold">21:9</div>
|
|
663
|
+
<div className="text-sm opacity-80">Ultra-wide</div>
|
|
664
|
+
</div>
|
|
665
|
+
</div>
|
|
666
|
+
</AspectRatio>
|
|
667
|
+
</div>
|
|
668
|
+
<div className="text-center">
|
|
669
|
+
<h4 className="text-lg font-semibold text-white">
|
|
670
|
+
Ultra-wide (21:9)
|
|
671
|
+
</h4>
|
|
672
|
+
<p className="text-sm text-white/60">
|
|
673
|
+
Cinematic, gaming monitors
|
|
674
|
+
</p>
|
|
675
|
+
</div>
|
|
676
|
+
</div>
|
|
677
|
+
|
|
678
|
+
{/* Portrait - 9:16 */}
|
|
679
|
+
<div className="group space-y-4">
|
|
680
|
+
<div className="mx-auto w-full max-w-sm">
|
|
681
|
+
<AspectRatio ratio={9 / 16}>
|
|
682
|
+
<div className="flex h-full w-full items-center justify-center rounded-lg bg-gradient-to-br from-pink-500 to-rose-500 text-white shadow-xl transition-transform duration-300 group-hover:scale-105">
|
|
683
|
+
<div className="text-center">
|
|
684
|
+
<div className="text-2xl font-bold">9:16</div>
|
|
685
|
+
<div className="text-sm opacity-80">Portrait</div>
|
|
686
|
+
</div>
|
|
687
|
+
</div>
|
|
688
|
+
</AspectRatio>
|
|
689
|
+
</div>
|
|
690
|
+
<div className="text-center">
|
|
691
|
+
<h4 className="text-lg font-semibold text-white">
|
|
692
|
+
Portrait (9:16)
|
|
693
|
+
</h4>
|
|
694
|
+
<p className="text-sm text-white/60">
|
|
695
|
+
Mobile screens, stories, reels
|
|
696
|
+
</p>
|
|
697
|
+
</div>
|
|
698
|
+
</div>
|
|
699
|
+
</div>
|
|
700
|
+
</div>
|
|
701
|
+
</div>
|
|
702
|
+
),
|
|
703
|
+
parameters: {
|
|
704
|
+
...storyParameters,
|
|
705
|
+
docs: {
|
|
706
|
+
description: {
|
|
707
|
+
story:
|
|
708
|
+
"Common aspect ratios used across different media types and platforms.",
|
|
709
|
+
},
|
|
710
|
+
},
|
|
711
|
+
},
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// 2. Image Gallery Example
|
|
715
|
+
export const ImageGallery: Story = {
|
|
716
|
+
render: () => (
|
|
717
|
+
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900/10 to-gray-900 p-8">
|
|
718
|
+
<div className="mx-auto max-w-7xl space-y-8">
|
|
719
|
+
<div className="text-center">
|
|
720
|
+
<h3 className="mb-4 bg-gradient-to-r from-white via-purple-200 to-white bg-clip-text text-3xl font-bold text-transparent">
|
|
721
|
+
Image Gallery
|
|
722
|
+
</h3>
|
|
723
|
+
<p className="mx-auto max-w-2xl text-lg text-white/80">
|
|
724
|
+
Consistent image thumbnails using AspectRatio for a clean gallery
|
|
725
|
+
layout
|
|
726
|
+
</p>
|
|
727
|
+
</div>
|
|
728
|
+
|
|
729
|
+
<div className="grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
|
|
730
|
+
{Array.from({ length: 12 }).map((_, i) => (
|
|
731
|
+
<div key={i} className="group cursor-pointer">
|
|
732
|
+
<AspectRatio ratio={1}>
|
|
733
|
+
<div className="relative h-full w-full overflow-hidden rounded-lg bg-gradient-to-br from-gray-800 to-gray-900 transition-transform duration-300 group-hover:scale-105">
|
|
734
|
+
<div
|
|
735
|
+
className={`absolute inset-0 bg-gradient-to-br ${
|
|
736
|
+
[
|
|
737
|
+
"from-red-500 to-pink-500",
|
|
738
|
+
"from-blue-500 to-cyan-500",
|
|
739
|
+
"from-green-500 to-emerald-500",
|
|
740
|
+
"from-purple-500 to-violet-500",
|
|
741
|
+
"from-orange-500 to-yellow-500",
|
|
742
|
+
"from-indigo-500 to-blue-500",
|
|
743
|
+
][i % 6]
|
|
744
|
+
} opacity-80`}
|
|
745
|
+
/>
|
|
746
|
+
<div className="absolute inset-0 flex items-center justify-center text-white">
|
|
747
|
+
<div className="text-center">
|
|
748
|
+
<div className="text-lg font-semibold">Image {i + 1}</div>
|
|
749
|
+
<div className="text-sm opacity-75">1:1 Ratio</div>
|
|
750
|
+
</div>
|
|
751
|
+
</div>
|
|
752
|
+
<div className="absolute inset-0 bg-black/20 opacity-0 transition-opacity group-hover:opacity-100" />
|
|
753
|
+
</div>
|
|
754
|
+
</AspectRatio>
|
|
755
|
+
</div>
|
|
756
|
+
))}
|
|
757
|
+
</div>
|
|
758
|
+
</div>
|
|
759
|
+
</div>
|
|
760
|
+
),
|
|
761
|
+
parameters: {
|
|
762
|
+
...storyParameters,
|
|
763
|
+
docs: {
|
|
764
|
+
description: {
|
|
765
|
+
story:
|
|
766
|
+
"Example of using AspectRatio for consistent image gallery thumbnails.",
|
|
767
|
+
},
|
|
768
|
+
},
|
|
769
|
+
},
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
// 3. Video Players
|
|
773
|
+
export const VideoPlayers: Story = {
|
|
774
|
+
render: () => (
|
|
775
|
+
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900/10 to-gray-900 p-8">
|
|
776
|
+
<div className="mx-auto max-w-7xl space-y-12">
|
|
777
|
+
<div className="text-center">
|
|
778
|
+
<h3 className="mb-4 bg-gradient-to-r from-white via-purple-200 to-white bg-clip-text text-3xl font-bold text-transparent">
|
|
779
|
+
Video Players
|
|
780
|
+
</h3>
|
|
781
|
+
<p className="mx-auto max-w-2xl text-lg text-white/80">
|
|
782
|
+
Standard video aspect ratios for different video content types
|
|
783
|
+
</p>
|
|
784
|
+
</div>
|
|
785
|
+
|
|
786
|
+
<div className="space-y-8">
|
|
787
|
+
{/* Widescreen Video */}
|
|
788
|
+
<div className="space-y-4">
|
|
789
|
+
<h4 className="text-xl font-semibold text-white">
|
|
790
|
+
Widescreen Video (16:9)
|
|
791
|
+
</h4>
|
|
792
|
+
<div className="mx-auto max-w-4xl">
|
|
793
|
+
<AspectRatio ratio={16 / 9}>
|
|
794
|
+
<div className="relative h-full w-full overflow-hidden rounded-lg bg-black shadow-2xl">
|
|
795
|
+
<div className="absolute inset-0 bg-gradient-to-br from-gray-900 to-black" />
|
|
796
|
+
<div className="absolute inset-0 flex items-center justify-center">
|
|
797
|
+
<div className="text-center text-white">
|
|
798
|
+
<div className="mb-4 text-6xl">▶️</div>
|
|
799
|
+
<div className="text-xl font-semibold">Video Player</div>
|
|
800
|
+
<div className="text-sm opacity-75">
|
|
801
|
+
16:9 Aspect Ratio
|
|
802
|
+
</div>
|
|
803
|
+
</div>
|
|
804
|
+
</div>
|
|
805
|
+
{/* Mock video controls */}
|
|
806
|
+
<div className="absolute right-0 bottom-0 left-0 bg-gradient-to-t from-black/80 to-transparent p-4">
|
|
807
|
+
<div className="flex items-center gap-4">
|
|
808
|
+
<button className="text-white">⏸️</button>
|
|
809
|
+
<div className="h-1 flex-1 rounded-full bg-white/20">
|
|
810
|
+
<div className="h-full w-1/3 rounded-full bg-red-500" />
|
|
811
|
+
</div>
|
|
812
|
+
<span className="text-sm text-white/75">1:23 / 4:56</span>
|
|
813
|
+
</div>
|
|
814
|
+
</div>
|
|
815
|
+
</div>
|
|
816
|
+
</AspectRatio>
|
|
817
|
+
</div>
|
|
818
|
+
</div>
|
|
819
|
+
|
|
820
|
+
{/* Traditional Video */}
|
|
821
|
+
<div className="space-y-4">
|
|
822
|
+
<h4 className="text-xl font-semibold text-white">
|
|
823
|
+
Traditional Video (4:3)
|
|
824
|
+
</h4>
|
|
825
|
+
<div className="mx-auto max-w-2xl">
|
|
826
|
+
<AspectRatio ratio={4 / 3}>
|
|
827
|
+
<div className="relative h-full w-full overflow-hidden rounded-lg bg-black shadow-2xl">
|
|
828
|
+
<div className="absolute inset-0 bg-gradient-to-br from-gray-900 to-black" />
|
|
829
|
+
<div className="absolute inset-0 flex items-center justify-center">
|
|
830
|
+
<div className="text-center text-white">
|
|
831
|
+
<div className="mb-4 text-5xl">📺</div>
|
|
832
|
+
<div className="text-lg font-semibold">
|
|
833
|
+
Classic TV Format
|
|
834
|
+
</div>
|
|
835
|
+
<div className="text-sm opacity-75">4:3 Aspect Ratio</div>
|
|
836
|
+
</div>
|
|
837
|
+
</div>
|
|
838
|
+
</div>
|
|
839
|
+
</AspectRatio>
|
|
840
|
+
</div>
|
|
841
|
+
</div>
|
|
842
|
+
|
|
843
|
+
{/* Mobile Video */}
|
|
844
|
+
<div className="space-y-4">
|
|
845
|
+
<h4 className="text-xl font-semibold text-white">
|
|
846
|
+
Mobile Video (9:16)
|
|
847
|
+
</h4>
|
|
848
|
+
<div className="mx-auto max-w-sm">
|
|
849
|
+
<AspectRatio ratio={9 / 16}>
|
|
850
|
+
<div className="relative h-full w-full overflow-hidden rounded-lg bg-black shadow-2xl">
|
|
851
|
+
<div className="absolute inset-0 bg-gradient-to-br from-gray-900 to-black" />
|
|
852
|
+
<div className="absolute inset-0 flex items-center justify-center">
|
|
853
|
+
<div className="text-center text-white">
|
|
854
|
+
<div className="mb-4 text-4xl">📱</div>
|
|
855
|
+
<div className="text-lg font-semibold">
|
|
856
|
+
Stories & Reels
|
|
857
|
+
</div>
|
|
858
|
+
<div className="text-sm opacity-75">
|
|
859
|
+
9:16 Aspect Ratio
|
|
860
|
+
</div>
|
|
861
|
+
</div>
|
|
862
|
+
</div>
|
|
863
|
+
</div>
|
|
864
|
+
</AspectRatio>
|
|
865
|
+
</div>
|
|
866
|
+
</div>
|
|
867
|
+
</div>
|
|
868
|
+
</div>
|
|
869
|
+
</div>
|
|
870
|
+
),
|
|
871
|
+
parameters: {
|
|
872
|
+
...storyParameters,
|
|
873
|
+
docs: {
|
|
874
|
+
description: {
|
|
875
|
+
story:
|
|
876
|
+
"Video player examples with different aspect ratios for various content types.",
|
|
877
|
+
},
|
|
878
|
+
},
|
|
879
|
+
},
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// 4. Card Layouts
|
|
883
|
+
export const CardLayouts: Story = {
|
|
884
|
+
render: () => (
|
|
885
|
+
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900/10 to-gray-900 p-8">
|
|
886
|
+
<div className="mx-auto max-w-7xl space-y-8">
|
|
887
|
+
<div className="text-center">
|
|
888
|
+
<h3 className="mb-4 bg-gradient-to-r from-white via-purple-200 to-white bg-clip-text text-3xl font-bold text-transparent">
|
|
889
|
+
Card Layouts
|
|
890
|
+
</h3>
|
|
891
|
+
<p className="mx-auto max-w-2xl text-lg text-white/80">
|
|
892
|
+
Consistent card designs using AspectRatio for uniform layouts
|
|
893
|
+
</p>
|
|
894
|
+
</div>
|
|
895
|
+
|
|
896
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
897
|
+
{[
|
|
898
|
+
{
|
|
899
|
+
title: "Product Card",
|
|
900
|
+
ratio: 4 / 3,
|
|
901
|
+
icon: "🛍️",
|
|
902
|
+
desc: "E-commerce product",
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
title: "Blog Card",
|
|
906
|
+
ratio: 16 / 9,
|
|
907
|
+
icon: "📝",
|
|
908
|
+
desc: "Article preview",
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
title: "Profile Card",
|
|
912
|
+
ratio: 1,
|
|
913
|
+
icon: "👤",
|
|
914
|
+
desc: "User profile",
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
title: "Recipe Card",
|
|
918
|
+
ratio: 3 / 2,
|
|
919
|
+
icon: "🍳",
|
|
920
|
+
desc: "Food & cooking",
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
title: "Event Card",
|
|
924
|
+
ratio: 16 / 9,
|
|
925
|
+
icon: "🎉",
|
|
926
|
+
desc: "Event listing",
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
title: "Portfolio Card",
|
|
930
|
+
ratio: 4 / 3,
|
|
931
|
+
icon: "🎨",
|
|
932
|
+
desc: "Creative work",
|
|
933
|
+
},
|
|
934
|
+
].map((card, i) => (
|
|
935
|
+
<div
|
|
936
|
+
key={i}
|
|
937
|
+
className="group cursor-pointer overflow-hidden rounded-xl border border-white/10 bg-white/5 transition-all duration-300 hover:scale-105 hover:border-white/20 hover:bg-white/10"
|
|
938
|
+
>
|
|
939
|
+
<AspectRatio ratio={card.ratio}>
|
|
940
|
+
<div
|
|
941
|
+
className={`relative h-full w-full bg-gradient-to-br ${
|
|
942
|
+
[
|
|
943
|
+
"from-blue-500 to-purple-600",
|
|
944
|
+
"from-green-500 to-teal-600",
|
|
945
|
+
"from-orange-500 to-red-600",
|
|
946
|
+
"from-purple-500 to-pink-600",
|
|
947
|
+
"from-indigo-500 to-blue-600",
|
|
948
|
+
"from-rose-500 to-orange-600",
|
|
949
|
+
][i % 6]
|
|
950
|
+
}`}
|
|
951
|
+
>
|
|
952
|
+
<div className="absolute inset-0 flex items-center justify-center text-white">
|
|
953
|
+
<div className="text-center">
|
|
954
|
+
<div className="mb-2 text-4xl">{card.icon}</div>
|
|
955
|
+
<div className="text-lg font-semibold">{card.title}</div>
|
|
956
|
+
</div>
|
|
957
|
+
</div>
|
|
958
|
+
<div className="absolute inset-0 bg-black/20 opacity-0 transition-opacity group-hover:opacity-100" />
|
|
959
|
+
</div>
|
|
960
|
+
</AspectRatio>
|
|
961
|
+
<div className="p-4">
|
|
962
|
+
<h4 className="font-semibold text-white">{card.title}</h4>
|
|
963
|
+
<p className="text-sm text-white/60">{card.desc}</p>
|
|
964
|
+
<div className="mt-2 text-xs text-purple-300">
|
|
965
|
+
Ratio: {card.ratio.toFixed(2)}
|
|
966
|
+
</div>
|
|
967
|
+
</div>
|
|
968
|
+
</div>
|
|
969
|
+
))}
|
|
970
|
+
</div>
|
|
971
|
+
</div>
|
|
972
|
+
</div>
|
|
973
|
+
),
|
|
974
|
+
parameters: {
|
|
975
|
+
...storyParameters,
|
|
976
|
+
docs: {
|
|
977
|
+
description: {
|
|
978
|
+
story:
|
|
979
|
+
"Card layout examples showing how AspectRatio creates consistent designs.",
|
|
980
|
+
},
|
|
981
|
+
},
|
|
982
|
+
},
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// 5. Interactive Playground
|
|
986
|
+
export const InteractivePlayground: Story = {
|
|
987
|
+
render: () => {
|
|
988
|
+
const [selectedRatio, setSelectedRatio] = React.useState<number | "custom">(
|
|
989
|
+
16 / 9
|
|
990
|
+
)
|
|
991
|
+
const [customWidth, setCustomWidth] = React.useState(16)
|
|
992
|
+
const [customHeight, setCustomHeight] = React.useState(9)
|
|
993
|
+
|
|
994
|
+
const presetRatios = [
|
|
995
|
+
{ name: "Square", value: 1, label: "1:1" },
|
|
996
|
+
{ name: "Widescreen", value: 16 / 9, label: "16:9" },
|
|
997
|
+
{ name: "Traditional", value: 4 / 3, label: "4:3" },
|
|
998
|
+
{ name: "Photography", value: 3 / 2, label: "3:2" },
|
|
999
|
+
{ name: "Ultra-wide", value: 21 / 9, label: "21:9" },
|
|
1000
|
+
{ name: "Portrait", value: 9 / 16, label: "9:16" },
|
|
1001
|
+
]
|
|
1002
|
+
|
|
1003
|
+
const currentRatio =
|
|
1004
|
+
selectedRatio === "custom" ? customWidth / customHeight : selectedRatio
|
|
1005
|
+
|
|
1006
|
+
return (
|
|
1007
|
+
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900/10 to-gray-900 p-8">
|
|
1008
|
+
<div className="mx-auto max-w-7xl space-y-8">
|
|
1009
|
+
<div className="text-center">
|
|
1010
|
+
<h3 className="mb-4 bg-gradient-to-r from-white via-purple-200 to-white bg-clip-text text-3xl font-bold text-transparent">
|
|
1011
|
+
Interactive Playground
|
|
1012
|
+
</h3>
|
|
1013
|
+
<p className="mx-auto max-w-2xl text-lg text-white/80">
|
|
1014
|
+
Experiment with different aspect ratios and see how they affect
|
|
1015
|
+
content layout
|
|
1016
|
+
</p>
|
|
1017
|
+
</div>
|
|
1018
|
+
|
|
1019
|
+
<div className="grid grid-cols-1 gap-8 lg:grid-cols-3">
|
|
1020
|
+
{/* Controls */}
|
|
1021
|
+
<div className="space-y-6 rounded-xl border border-white/10 bg-white/5 p-6">
|
|
1022
|
+
<h4 className="text-lg font-semibold text-white">Controls</h4>
|
|
1023
|
+
|
|
1024
|
+
{/* Preset Ratios */}
|
|
1025
|
+
<div className="space-y-3">
|
|
1026
|
+
<label className="text-sm font-medium text-white">
|
|
1027
|
+
Preset Ratios
|
|
1028
|
+
</label>
|
|
1029
|
+
<div className="grid grid-cols-2 gap-2">
|
|
1030
|
+
{presetRatios.map((preset) => (
|
|
1031
|
+
<button
|
|
1032
|
+
key={preset.name}
|
|
1033
|
+
onClick={() => setSelectedRatio(preset.value)}
|
|
1034
|
+
className={`rounded-lg px-3 py-2 text-sm transition-colors ${
|
|
1035
|
+
selectedRatio === preset.value
|
|
1036
|
+
? "bg-purple-500 text-white"
|
|
1037
|
+
: "bg-white/10 text-white/80 hover:bg-white/20"
|
|
1038
|
+
}`}
|
|
1039
|
+
>
|
|
1040
|
+
{preset.label}
|
|
1041
|
+
</button>
|
|
1042
|
+
))}
|
|
1043
|
+
</div>
|
|
1044
|
+
</div>
|
|
1045
|
+
|
|
1046
|
+
{/* Custom Ratio */}
|
|
1047
|
+
<div className="space-y-3">
|
|
1048
|
+
<label className="text-sm font-medium text-white">
|
|
1049
|
+
Custom Ratio
|
|
1050
|
+
</label>
|
|
1051
|
+
<div className="flex items-center gap-2">
|
|
1052
|
+
<input
|
|
1053
|
+
type="number"
|
|
1054
|
+
min="1"
|
|
1055
|
+
max="50"
|
|
1056
|
+
value={customWidth}
|
|
1057
|
+
onChange={(e) => {
|
|
1058
|
+
setCustomWidth(Number(e.target.value))
|
|
1059
|
+
setSelectedRatio("custom")
|
|
1060
|
+
}}
|
|
1061
|
+
className="w-20 rounded-lg border border-white/20 bg-white/10 px-3 py-2 text-sm text-white placeholder-white/50"
|
|
1062
|
+
/>
|
|
1063
|
+
<span className="text-white">:</span>
|
|
1064
|
+
<input
|
|
1065
|
+
type="number"
|
|
1066
|
+
min="1"
|
|
1067
|
+
max="50"
|
|
1068
|
+
value={customHeight}
|
|
1069
|
+
onChange={(e) => {
|
|
1070
|
+
setCustomHeight(Number(e.target.value))
|
|
1071
|
+
setSelectedRatio("custom")
|
|
1072
|
+
}}
|
|
1073
|
+
className="w-20 rounded-lg border border-white/20 bg-white/10 px-3 py-2 text-sm text-white placeholder-white/50"
|
|
1074
|
+
/>
|
|
1075
|
+
</div>
|
|
1076
|
+
<button
|
|
1077
|
+
onClick={() => setSelectedRatio(customWidth / customHeight)}
|
|
1078
|
+
className="w-full rounded-lg bg-purple-500/20 px-3 py-2 text-sm text-purple-300 transition-colors hover:bg-purple-500/30"
|
|
1079
|
+
>
|
|
1080
|
+
Apply Custom ({customWidth}:{customHeight})
|
|
1081
|
+
</button>
|
|
1082
|
+
</div>
|
|
1083
|
+
|
|
1084
|
+
{/* Current Info */}
|
|
1085
|
+
<div className="space-y-2 rounded-lg bg-white/5 p-4">
|
|
1086
|
+
<div className="text-sm font-medium text-white">
|
|
1087
|
+
Current Ratio
|
|
1088
|
+
</div>
|
|
1089
|
+
<div className="text-lg font-bold text-purple-300">
|
|
1090
|
+
{currentRatio.toFixed(3)}
|
|
1091
|
+
</div>
|
|
1092
|
+
<div className="text-xs text-white/60">
|
|
1093
|
+
{selectedRatio === "custom"
|
|
1094
|
+
? `${customWidth}:${customHeight}`
|
|
1095
|
+
: presetRatios.find((p) => p.value === selectedRatio)
|
|
1096
|
+
?.label || "Custom"}
|
|
1097
|
+
</div>
|
|
1098
|
+
</div>
|
|
1099
|
+
</div>
|
|
1100
|
+
|
|
1101
|
+
{/* Preview */}
|
|
1102
|
+
<div className="lg:col-span-2">
|
|
1103
|
+
<div className="space-y-4 rounded-xl border border-white/10 bg-white/5 p-6">
|
|
1104
|
+
<h4 className="text-lg font-semibold text-white">Preview</h4>
|
|
1105
|
+
<div className="mx-auto max-w-lg">
|
|
1106
|
+
<AspectRatio ratio={currentRatio}>
|
|
1107
|
+
<div className="relative h-full w-full overflow-hidden rounded-lg bg-gradient-to-br from-blue-500 via-purple-500 to-pink-500 shadow-xl">
|
|
1108
|
+
<div className="absolute inset-0 flex items-center justify-center text-white">
|
|
1109
|
+
<div className="text-center">
|
|
1110
|
+
<div className="text-2xl font-bold">
|
|
1111
|
+
{selectedRatio === "custom"
|
|
1112
|
+
? `${customWidth}:${customHeight}`
|
|
1113
|
+
: presetRatios.find(
|
|
1114
|
+
(p) => p.value === selectedRatio
|
|
1115
|
+
)?.label || currentRatio.toFixed(2)}
|
|
1116
|
+
</div>
|
|
1117
|
+
<div className="text-sm opacity-80">Aspect Ratio</div>
|
|
1118
|
+
<div className="mt-2 text-xs opacity-60">
|
|
1119
|
+
Decimal: {currentRatio.toFixed(3)}
|
|
1120
|
+
</div>
|
|
1121
|
+
</div>
|
|
1122
|
+
</div>
|
|
1123
|
+
{/* Grid overlay */}
|
|
1124
|
+
<div className="absolute inset-0 opacity-20">
|
|
1125
|
+
<div className="grid h-full w-full grid-cols-3 grid-rows-3 gap-px">
|
|
1126
|
+
{Array.from({ length: 9 }).map((_, i) => (
|
|
1127
|
+
<div key={i} className="border border-white/30" />
|
|
1128
|
+
))}
|
|
1129
|
+
</div>
|
|
1130
|
+
</div>
|
|
1131
|
+
</div>
|
|
1132
|
+
</AspectRatio>
|
|
1133
|
+
</div>
|
|
1134
|
+
|
|
1135
|
+
{/* Code Example */}
|
|
1136
|
+
<div className="space-y-2">
|
|
1137
|
+
<label className="text-sm font-medium text-white">Code</label>
|
|
1138
|
+
<div className="rounded-lg bg-black/40 p-4">
|
|
1139
|
+
<pre className="text-sm text-green-300">
|
|
1140
|
+
{`<AspectRatio ratio={${currentRatio.toFixed(3)}}>
|
|
1141
|
+
<div className="h-full w-full bg-gradient-to-br
|
|
1142
|
+
from-blue-500 to-purple-500">
|
|
1143
|
+
Your content here
|
|
1144
|
+
</div>
|
|
1145
|
+
</AspectRatio>`}
|
|
1146
|
+
</pre>
|
|
1147
|
+
</div>
|
|
1148
|
+
</div>
|
|
1149
|
+
</div>
|
|
1150
|
+
</div>
|
|
1151
|
+
</div>
|
|
1152
|
+
</div>
|
|
1153
|
+
</div>
|
|
1154
|
+
)
|
|
1155
|
+
},
|
|
1156
|
+
parameters: {
|
|
1157
|
+
...storyParameters,
|
|
1158
|
+
docs: {
|
|
1159
|
+
description: {
|
|
1160
|
+
story:
|
|
1161
|
+
"Interactive playground to experiment with different aspect ratios.",
|
|
1162
|
+
},
|
|
1163
|
+
},
|
|
1164
|
+
},
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// 6. Real World Examples
|
|
1168
|
+
export const RealWorldExamples: Story = {
|
|
1169
|
+
render: () => (
|
|
1170
|
+
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-purple-900/10 to-gray-900 p-8">
|
|
1171
|
+
<div className="mx-auto max-w-7xl space-y-12">
|
|
1172
|
+
<div className="text-center">
|
|
1173
|
+
<h3 className="mb-4 bg-gradient-to-r from-white via-purple-200 to-white bg-clip-text text-3xl font-bold text-transparent">
|
|
1174
|
+
Real World Examples
|
|
1175
|
+
</h3>
|
|
1176
|
+
<p className="mx-auto max-w-2xl text-lg text-white/80">
|
|
1177
|
+
Practical implementations of AspectRatio in common UI patterns
|
|
1178
|
+
</p>
|
|
1179
|
+
</div>
|
|
1180
|
+
|
|
1181
|
+
{/* Social Media Feed */}
|
|
1182
|
+
<div className="space-y-6">
|
|
1183
|
+
<h4 className="text-xl font-semibold text-white">
|
|
1184
|
+
Social Media Feed
|
|
1185
|
+
</h4>
|
|
1186
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
1187
|
+
{Array.from({ length: 6 }).map((_, i) => (
|
|
1188
|
+
<div
|
|
1189
|
+
key={i}
|
|
1190
|
+
className="overflow-hidden rounded-xl border border-white/10 bg-white/5"
|
|
1191
|
+
>
|
|
1192
|
+
<AspectRatio ratio={1}>
|
|
1193
|
+
<div
|
|
1194
|
+
className={`relative h-full w-full bg-gradient-to-br ${
|
|
1195
|
+
[
|
|
1196
|
+
"from-pink-500 to-rose-500",
|
|
1197
|
+
"from-blue-500 to-indigo-500",
|
|
1198
|
+
"from-green-500 to-emerald-500",
|
|
1199
|
+
"from-purple-500 to-violet-500",
|
|
1200
|
+
"from-orange-500 to-amber-500",
|
|
1201
|
+
"from-cyan-500 to-blue-500",
|
|
1202
|
+
][i % 6]
|
|
1203
|
+
}`}
|
|
1204
|
+
>
|
|
1205
|
+
<div className="absolute inset-0 flex items-center justify-center text-white">
|
|
1206
|
+
<div className="text-4xl">
|
|
1207
|
+
{["🌟", "🎨", "🚀", "💎", "🔥", "⚡"][i % 6]}
|
|
1208
|
+
</div>
|
|
1209
|
+
</div>
|
|
1210
|
+
</div>
|
|
1211
|
+
</AspectRatio>
|
|
1212
|
+
<div className="p-4">
|
|
1213
|
+
<div className="flex items-center gap-3">
|
|
1214
|
+
<div className="h-8 w-8 rounded-full bg-gradient-to-br from-gray-600 to-gray-700" />
|
|
1215
|
+
<div>
|
|
1216
|
+
<div className="text-sm font-medium text-white">
|
|
1217
|
+
@user{i + 1}
|
|
1218
|
+
</div>
|
|
1219
|
+
<div className="text-xs text-white/60">2 hours ago</div>
|
|
1220
|
+
</div>
|
|
1221
|
+
</div>
|
|
1222
|
+
<p className="mt-2 text-sm text-white/80">
|
|
1223
|
+
Beautiful post content with perfect aspect ratio!
|
|
1224
|
+
#photography
|
|
1225
|
+
</p>
|
|
1226
|
+
</div>
|
|
1227
|
+
</div>
|
|
1228
|
+
))}
|
|
1229
|
+
</div>
|
|
1230
|
+
</div>
|
|
1231
|
+
|
|
1232
|
+
{/* E-commerce Grid */}
|
|
1233
|
+
<div className="space-y-6">
|
|
1234
|
+
<h4 className="text-xl font-semibold text-white">
|
|
1235
|
+
E-commerce Product Grid
|
|
1236
|
+
</h4>
|
|
1237
|
+
<div className="grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
|
|
1238
|
+
{Array.from({ length: 8 }).map((_, i) => (
|
|
1239
|
+
<div
|
|
1240
|
+
key={i}
|
|
1241
|
+
className="group cursor-pointer overflow-hidden rounded-lg border border-white/10 bg-white/5 transition-transform duration-200 hover:scale-105"
|
|
1242
|
+
>
|
|
1243
|
+
<AspectRatio ratio={1}>
|
|
1244
|
+
<div className="relative h-full w-full bg-gradient-to-br from-gray-700 to-gray-800">
|
|
1245
|
+
<div className="absolute inset-0 flex items-center justify-center text-white">
|
|
1246
|
+
<div className="text-center">
|
|
1247
|
+
<div className="mb-2 text-2xl">
|
|
1248
|
+
{["👟", "👕", "⌚", "🎧", "📱", "💻", "🎒", "📷"][i]}
|
|
1249
|
+
</div>
|
|
1250
|
+
<div className="text-xs opacity-75">
|
|
1251
|
+
Product {i + 1}
|
|
1252
|
+
</div>
|
|
1253
|
+
</div>
|
|
1254
|
+
</div>
|
|
1255
|
+
<div className="absolute top-2 right-2">
|
|
1256
|
+
<div className="rounded-full bg-red-500 px-2 py-1 text-xs text-white">
|
|
1257
|
+
Sale
|
|
1258
|
+
</div>
|
|
1259
|
+
</div>
|
|
1260
|
+
</div>
|
|
1261
|
+
</AspectRatio>
|
|
1262
|
+
<div className="p-3">
|
|
1263
|
+
<h5 className="text-sm font-medium text-white">
|
|
1264
|
+
Product Name
|
|
1265
|
+
</h5>
|
|
1266
|
+
<p className="text-lg font-bold text-purple-300">$99.99</p>
|
|
1267
|
+
</div>
|
|
1268
|
+
</div>
|
|
1269
|
+
))}
|
|
1270
|
+
</div>
|
|
1271
|
+
</div>
|
|
1272
|
+
|
|
1273
|
+
{/* Video Thumbnails */}
|
|
1274
|
+
<div className="space-y-6">
|
|
1275
|
+
<h4 className="text-xl font-semibold text-white">Video Thumbnails</h4>
|
|
1276
|
+
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
1277
|
+
{Array.from({ length: 6 }).map((_, i) => (
|
|
1278
|
+
<div key={i} className="group cursor-pointer space-y-3">
|
|
1279
|
+
<AspectRatio ratio={16 / 9}>
|
|
1280
|
+
<div className="relative h-full w-full overflow-hidden rounded-lg bg-gradient-to-br from-gray-800 to-black">
|
|
1281
|
+
<div className="absolute inset-0 flex items-center justify-center">
|
|
1282
|
+
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-sm transition-transform group-hover:scale-110">
|
|
1283
|
+
<div className="text-2xl">▶️</div>
|
|
1284
|
+
</div>
|
|
1285
|
+
</div>
|
|
1286
|
+
<div className="absolute right-2 bottom-2 rounded bg-black/80 px-2 py-1 text-xs text-white">
|
|
1287
|
+
{["12:34", "8:45", "15:22", "6:18", "20:15", "4:32"][i]}
|
|
1288
|
+
</div>
|
|
1289
|
+
<div
|
|
1290
|
+
className={`absolute inset-0 bg-gradient-to-br opacity-60 ${
|
|
1291
|
+
[
|
|
1292
|
+
"from-red-500 to-pink-500",
|
|
1293
|
+
"from-blue-500 to-cyan-500",
|
|
1294
|
+
"from-green-500 to-teal-500",
|
|
1295
|
+
"from-purple-500 to-indigo-500",
|
|
1296
|
+
"from-orange-500 to-yellow-500",
|
|
1297
|
+
"from-indigo-500 to-purple-500",
|
|
1298
|
+
][i % 6]
|
|
1299
|
+
}`}
|
|
1300
|
+
/>
|
|
1301
|
+
</div>
|
|
1302
|
+
</AspectRatio>
|
|
1303
|
+
<div>
|
|
1304
|
+
<h5 className="text-sm font-medium text-white">
|
|
1305
|
+
Video Title: Amazing Content #{i + 1}
|
|
1306
|
+
</h5>
|
|
1307
|
+
<p className="text-xs text-white/60">
|
|
1308
|
+
Channel Name • 1.2M views • 2 days ago
|
|
1309
|
+
</p>
|
|
1310
|
+
</div>
|
|
1311
|
+
</div>
|
|
1312
|
+
))}
|
|
1313
|
+
</div>
|
|
1314
|
+
</div>
|
|
1315
|
+
</div>
|
|
1316
|
+
</div>
|
|
1317
|
+
),
|
|
1318
|
+
parameters: {
|
|
1319
|
+
...storyParameters,
|
|
1320
|
+
docs: {
|
|
1321
|
+
description: {
|
|
1322
|
+
story:
|
|
1323
|
+
"Real-world examples showing AspectRatio in common UI patterns like social feeds, e-commerce, and video platforms.",
|
|
1324
|
+
},
|
|
1325
|
+
},
|
|
1326
|
+
},
|
|
1327
|
+
}
|