aural-ui 3.0.7 → 4.1.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/dist/components/aspect-ratio/AspectRatio.stories.tsx +290 -1199
- package/dist/components/avatar/Avatar.stories.tsx +235 -237
- package/dist/components/badge/Badge.stories.tsx +379 -116
- package/dist/components/banner/Banner.stories.tsx +445 -391
- package/dist/components/breadcrumb/Breadcrumb.stories.tsx +453 -199
- package/dist/components/button/Button.stories.tsx +585 -230
- package/dist/components/button/index.tsx +7 -7
- package/dist/components/card/Card.stories.tsx +619 -301
- package/dist/components/char-count/CharCount.stories.tsx +350 -248
- package/dist/components/checkbox/Checkbox.stories.tsx +309 -167
- package/dist/components/chip/Chip.stories.tsx +362 -168
- package/dist/components/circular-loader/CircularLoader.stories.tsx +221 -620
- package/dist/components/clamp-lines/ClampLines.stories.tsx +246 -117
- package/dist/components/collapsible/Collapsible.stories.tsx +391 -252
- package/dist/components/command/Command.stories.tsx +533 -856
- package/dist/components/dialog/Dialog.stories.tsx +505 -949
- package/dist/components/divider/Divider.stories.tsx +265 -502
- package/dist/components/dot-loader/DotLoader.stories.tsx +256 -257
- package/dist/components/drawer/Drawer.stories.tsx +659 -993
- package/dist/components/drawer/index.tsx +3 -3
- package/dist/components/dropdown/Dropdown.stories.tsx +643 -1018
- package/dist/components/form/Form.stories.tsx +560 -274
- package/dist/components/helper-text/HelperText.stories.tsx +199 -200
- package/dist/components/hover-card/HoverCard.stories.tsx +318 -1221
- package/dist/components/icon-button/IconButton.stories.tsx +837 -194
- package/dist/components/if-else/if-else.stories.tsx +370 -83
- package/dist/components/input/Input.stories.tsx +436 -368
- package/dist/components/label/Label.stories.tsx +156 -154
- package/dist/components/list/List.stories.tsx +485 -822
- package/dist/components/marquee/Marquee.stories.tsx +356 -694
- package/dist/components/otp-inputs/OtpInputs.stories.tsx +352 -410
- package/dist/components/overlay/Overlay.stories.tsx +452 -818
- package/dist/components/overlay/index.tsx +4 -4
- package/dist/components/pagination/Pagination.stories.tsx +721 -210
- package/dist/components/popover/Popover.stories.tsx +484 -873
- package/dist/components/radio/Radio.stories.tsx +432 -124
- package/dist/components/resizable/Resizable.stories.tsx +496 -752
- package/dist/components/scroll-area/ScrollArea.stories.tsx +384 -1006
- package/dist/components/search/Search.stories.tsx +314 -575
- package/dist/components/select/Select.stories.tsx +684 -787
- package/dist/components/sheet/Sheet.stories.tsx +671 -936
- package/dist/components/skelton/Skelton.stories.tsx +230 -764
- package/dist/components/slider/Slider.stories.tsx +384 -737
- package/dist/components/stepper/Stepper.stories.tsx +371 -514
- package/dist/components/switch/Switch.stories.tsx +461 -208
- package/dist/components/switch-case/SwitchCase.stories.tsx +367 -188
- package/dist/components/table/Table.stories.tsx +770 -914
- package/dist/components/tabs/Tabs.stories.tsx +459 -1400
- package/dist/components/tag/Tag.stories.tsx +714 -542
- package/dist/components/textarea/TextArea.stories.tsx +621 -562
- package/dist/components/thumbnail-tags/ThumbnailTags.stories.tsx +228 -148
- package/dist/components/toast/Toast.stories.tsx +452 -1333
- package/dist/components/toggle/Toggle.stories.tsx +488 -909
- package/dist/components/tooltip/Tooltip.stories.tsx +344 -1372
- package/dist/components/typography/Typography.stories.tsx +406 -89
- package/dist/hooks/use-change-state/UseChangeState.stories.tsx +309 -606
- package/dist/hooks/use-previous/UsePrevious.stories.tsx +367 -917
- package/dist/hooks/use-standalone-pagination/UseStandalonePagination.stories.tsx +639 -867
- package/dist/icons/Icons.stories.tsx +0 -12
- package/dist/icons/ai-avatar-icon/AiAvatarIcon.stories.tsx +226 -1013
- package/dist/icons/alert-icon/AlertIcon.stories.tsx +109 -929
- package/dist/icons/all-icons.tsx +124 -87
- package/dist/icons/angle-down-icon/AngleDownIcon.stories.tsx +140 -971
- package/dist/icons/apple-logo-icon/AppleLogoIcon.stories.tsx +148 -888
- package/dist/icons/arrow-box-left-icon/ArrowBoxLeftIcon.stories.tsx +135 -1019
- package/dist/icons/arrow-corner-up-left-icon/ArrowCornerUpLeftIcon.stories.tsx +137 -953
- package/dist/icons/arrow-corner-up-right-icon/ArrowCornerUpRightIcon.stories.tsx +138 -997
- package/dist/icons/arrow-left-icon/ArrowLeftIcon.stories.tsx +136 -942
- package/dist/icons/arrow-right-icon/ArrowRightIcon.stories.tsx +148 -1092
- package/dist/icons/arrow-right-up-icon/ArrowRightUpIcon.stories.tsx +146 -1211
- package/dist/icons/art-board-icon/ArtBoardIcon.stories.tsx +126 -615
- package/dist/icons/audio-bar-icon/AudioBarIcon.stories.tsx +144 -1164
- package/dist/icons/backward-ten-seconds-icon/BackwardTenSecondsIcon.stories.tsx +167 -985
- package/dist/icons/bubble-check-icon/BubbleCheckIcon.stories.tsx +122 -1179
- package/dist/icons/bubble-crossed-icon/BubbleCrossedIcon.stories.tsx +124 -1168
- package/dist/icons/bubble-sparkle-icon/BubbleSparkleIcon.stories.tsx +119 -850
- package/dist/icons/camera-icon/CameraIcon.stories.tsx +112 -1213
- package/dist/icons/capital-a-letter-icon/CapitalALetterIcon.stories.tsx +117 -934
- package/dist/icons/chevron-double-left-icon/ChevronDoubleLeftIcon.stories.tsx +160 -961
- package/dist/icons/chevron-double-right-icon/ChevronDoubleRightIcon.stories.tsx +163 -961
- package/dist/icons/chevron-down-icon/ChevronDownIcon.stories.tsx +144 -942
- package/dist/icons/chevron-left-icon/ChevronLeftIcon.stories.tsx +129 -966
- package/dist/icons/chevron-right-icon/ChevronRightIcon.stories.tsx +147 -964
- package/dist/icons/chevron-up-icon/ChevronUpIcon.stories.tsx +145 -975
- package/dist/icons/circle-tick-icon/CircleTickIcon.stories.tsx +150 -1142
- package/dist/icons/circular-play-icon/CircularPlayIcon.stories.tsx +114 -461
- package/dist/icons/coin-icon/CoinIcon.stories.tsx +124 -1322
- package/dist/icons/coin-toons-icon/CoinToonsIcon.stories.tsx +117 -1318
- package/dist/icons/column-wide-add-icon/ColumnWideAddIcon.stories.tsx +114 -903
- package/dist/icons/command-icon/CommandIcon.stories.tsx +127 -1042
- package/dist/icons/copy-icon/CopyIcon.stories.tsx +123 -962
- package/dist/icons/cross-circle-icon/CrossCircleIcon.stories.tsx +147 -999
- package/dist/icons/cross-icon/CrossIcon.stories.tsx +139 -960
- package/dist/icons/download-icon/DownloadIcon.stories.tsx +126 -820
- package/dist/icons/edit-big-icon/EditBigIcon.stories.tsx +124 -1031
- package/dist/icons/email-icon/EmailIcon.stories.tsx +115 -936
- package/dist/icons/expand-icon/ExpandIcon.stories.tsx +112 -1111
- package/dist/icons/eye-close-icon/EyeCloseIcon.stories.tsx +144 -1025
- package/dist/icons/eye-open-icon/EyeOpenIcon.stories.tsx +143 -1036
- package/dist/icons/feature-shine-icon/FeatureShineIcon.stories.tsx +127 -1011
- package/dist/icons/file-chart-icon/FileChartIcon.stories.tsx +126 -1056
- package/dist/icons/file-text-icon/FileTextIcon.stories.tsx +125 -614
- package/dist/icons/filter-bar-row-icon/FilterBarRowIcon.stories.tsx +119 -1050
- package/dist/icons/forward-ten-seconds-icon/ForwardTenSecondsIcon.stories.tsx +169 -989
- package/dist/icons/git-branch-icon/GitBranchIcon.stories.tsx +115 -1145
- package/dist/icons/git-fork-icon/GitForkIcon.stories.tsx +115 -1122
- package/dist/icons/globe-icon/GlobeIcon.stories.tsx +130 -313
- package/dist/icons/google-logo-icon/GoogleLogoIcon.stories.tsx +145 -940
- package/dist/icons/grip-vertical-icon/GripVerticalIcon.stories.tsx +119 -1174
- package/dist/icons/head-icon/HeadIcon.stories.tsx +111 -916
- package/dist/icons/heart-icon/HeartIcon.stories.tsx +120 -1019
- package/dist/icons/image-avatar-sparkle-icon/ImageAvatarSparkleIcon.stories.tsx +119 -683
- package/dist/icons/image-icon/ImageIcon.stories.tsx +105 -1121
- package/dist/icons/import-folder-icon/ImportFolderIcon.stories.tsx +111 -1192
- package/dist/icons/import-left-arrow-folder-icon/ImportLeftArrowFolderIcon.stories.tsx +136 -1256
- package/dist/icons/indian-flag-icon/IndianFlagIcon.stories.tsx +159 -962
- package/dist/icons/instagram-icon/InstagramIcon.stories.tsx +161 -1385
- package/dist/icons/layout-column-icon/LayoutColumnIcon.stories.tsx +124 -972
- package/dist/icons/layout-left-icon/LayoutLeftIcon.stories.tsx +119 -948
- package/dist/icons/layout-right-icon/LayoutRightIcon.stories.tsx +119 -942
- package/dist/icons/light-bulb-simple-icon/LightBulbSimpleIcon.stories.tsx +108 -1215
- package/dist/icons/linked-in-icon/LinkedInIcon.stories.tsx +154 -1517
- package/dist/icons/magic-book-icon/MagicBookIcon.stories.tsx +110 -1188
- package/dist/icons/magic-edit-icon/MagicEditIcon.stories.tsx +119 -678
- package/dist/icons/maintenance-icon/MaintenanceIcon.stories.tsx +123 -1184
- package/dist/icons/message-icon/MessageIcon.stories.tsx +114 -538
- package/dist/icons/minimize-icon/MinimizeIcon.stories.tsx +116 -1158
- package/dist/icons/moon-icon/MoonIcon.stories.tsx +120 -536
- package/dist/icons/move-horizontal-icon/MoveHorizontalIcon.stories.tsx +109 -1184
- package/dist/icons/move-vertical-icon/MoveVerticalIcon.stories.tsx +115 -1134
- package/dist/icons/musical-note-icon/MusicalNoteIcon.stories.tsx +119 -971
- package/dist/icons/notepad-icon/NotepadIcon.stories.tsx +111 -1100
- package/dist/icons/notes-icon/NotesIcon.stories.tsx +119 -1101
- package/dist/icons/page-search-icon/PageSearchIcon.stories.tsx +109 -1111
- package/dist/icons/page-text-icon/PageTextIcon.stories.tsx +122 -684
- package/dist/icons/paint-roll-icon/PaintRollIcon.stories.tsx +113 -954
- package/dist/icons/paper-plane-icon/PaperPlaneIcon.stories.tsx +112 -877
- package/dist/icons/pause-icon/PauseIcon.stories.tsx +113 -1000
- package/dist/icons/pencil-icon/PencilIcon.stories.tsx +115 -1070
- package/dist/icons/phone-icon/PhoneIcon.stories.tsx +115 -978
- package/dist/icons/plus-icon/PlusIcon.stories.tsx +106 -1093
- package/dist/icons/pocket-studio-icon/PocketStudioIcon.stories.tsx +107 -829
- package/dist/icons/scroll-down-icon/ScrollDownIcon.stories.tsx +102 -469
- package/dist/icons/search-icon/SearchIcon.stories.tsx +111 -1124
- package/dist/icons/setting-icon/SettingIcon.stories.tsx +107 -970
- package/dist/icons/share-icon/ShareIcon.stories.tsx +120 -1025
- package/dist/icons/shield-icon/ShieldIcon.stories.tsx +117 -931
- package/dist/icons/site-logo-icon/SiteLogoIcon.stories.tsx +137 -1104
- package/dist/icons/skip-backward-icon/SkipBackwardIcon.stories.tsx +172 -982
- package/dist/icons/skip-forward-icon/SkipForwardIcon.stories.tsx +164 -983
- package/dist/icons/sparkles-soft-icon/SparklesSoftIcon.stories.tsx +105 -958
- package/dist/icons/spinner-gradient-icon/SpinnerGradientIcon.stories.tsx +158 -580
- package/dist/icons/spinner-gradient-icon/index.tsx +6 -1
- package/dist/icons/spinner-solid-icon/SpinnerSolidIcon.stories.tsx +158 -587
- package/dist/icons/spinner-solid-icon/index.tsx +6 -1
- package/dist/icons/spinner-solid-neutral-icon/SpinnerSolidINeutralcon.stories.tsx +146 -682
- package/dist/icons/spinner-solid-neutral-icon/index.tsx +1 -1
- package/dist/icons/star-icon/StarIcon.stories.tsx +124 -904
- package/dist/icons/store-coin-icon/StoreCoinIcon.stories.tsx +112 -964
- package/dist/icons/suggestion-icon/SuggestionIcon.stories.tsx +116 -852
- package/dist/icons/sun-icon/SunIcon.stories.tsx +120 -831
- package/dist/icons/text-color-icon/TextColorIcon.stories.tsx +116 -950
- package/dist/icons/text-indicator-icon/TextIndicatorIcon.stories.tsx +123 -980
- package/dist/icons/threads-icon/ThreadsIcon.stories.tsx +156 -1427
- package/dist/icons/tick-circle-icon/TickCircleIcon.stories.tsx +146 -1142
- package/dist/icons/tick-icon/TickIcon.stories.tsx +145 -1276
- package/dist/icons/trash-icon/TrashIcon.stories.tsx +108 -933
- package/dist/icons/twitter-x-icon/TwitterXIcon.stories.tsx +157 -1402
- package/dist/icons/upload-icon/UploadIcon.stories.tsx +115 -889
- package/dist/icons/vertical-menu-icon/VerticalMenuIcon.stories.tsx +118 -984
- package/dist/icons/video-play-list-icon/VideoPlaylistIcon.stories.tsx +125 -1049
- package/dist/icons/voice-playing-icon/VoicePlayingIcon.stories.tsx +123 -1356
- package/dist/icons/volume-full-icon/VolumeFullIcon.stories.tsx +110 -1171
- package/dist/icons/volume-half-icon/VolumeHalfIcon.stories.tsx +112 -1093
- package/dist/icons/volume-off-icon/VolumeOffIcon.stories.tsx +115 -1087
- package/dist/icons/warning-icon/WarningIcon.stories.tsx +122 -1046
- package/dist/icons/youtube-icon/YoutubeIcon.stories.tsx +161 -936
- package/dist/index.cjs +84 -84
- package/dist/index.js +84 -84
- package/dist/styles/aural-all-theme.css +1222 -0
- package/dist/styles/{aural-theme.css → aural-dark-theme.css} +15 -3
- package/dist/styles/aural-light-theme.css +1047 -0
- package/package.json +1 -1
|
@@ -1,538 +1,37 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
3
3
|
|
|
4
|
+
import { AuralComponentDocsPage } from "src/ui/story-spec/components/component-story-docs-page"
|
|
5
|
+
|
|
4
6
|
import { AspectRatio } from "."
|
|
5
7
|
|
|
6
8
|
const meta: Meta<typeof AspectRatio> = {
|
|
7
9
|
title: "Components/UI/AspectRatio",
|
|
8
10
|
component: AspectRatio,
|
|
9
11
|
parameters: {
|
|
10
|
-
layout: "
|
|
11
|
-
backgrounds: {
|
|
12
|
-
default: "dark",
|
|
13
|
-
values: [
|
|
14
|
-
{ name: "dark", value: "#0a0a0a" },
|
|
15
|
-
{ name: "darker", value: "#000000" },
|
|
16
|
-
{ name: "light", value: "#ffffff" },
|
|
17
|
-
],
|
|
18
|
-
},
|
|
12
|
+
layout: "centered",
|
|
19
13
|
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"A utility component for maintaining consistent aspect ratios across different content types and screen sizes. Built on Radix UI primitives for reliability.",
|
|
17
|
+
},
|
|
20
18
|
page: () => (
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
</>
|
|
19
|
+
<AuralComponentDocsPage
|
|
20
|
+
features={[
|
|
21
|
+
{
|
|
22
|
+
title: "Ratio Flexibility",
|
|
23
|
+
description: "Any numeric ratio",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: "Content-Agnostic",
|
|
27
|
+
description: "Works with any content",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: "Responsive by Design",
|
|
31
|
+
description: "Scales at any viewport",
|
|
32
|
+
},
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
536
35
|
),
|
|
537
36
|
},
|
|
538
37
|
},
|
|
@@ -542,212 +41,132 @@ const meta: Meta<typeof AspectRatio> = {
|
|
|
542
41
|
export default meta
|
|
543
42
|
type Story = StoryObj<typeof AspectRatio>
|
|
544
43
|
|
|
545
|
-
//
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
44
|
+
// ─── 1. Configurations ───────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
const COMMON_RATIOS = [
|
|
47
|
+
{
|
|
48
|
+
ratio: 1,
|
|
49
|
+
label: "1:1",
|
|
50
|
+
name: "Square",
|
|
51
|
+
desc: "Avatars, social posts",
|
|
52
|
+
bg: "from-fm-secondary-500 to-fm-hotpink-500",
|
|
553
53
|
},
|
|
554
|
-
|
|
54
|
+
{
|
|
55
|
+
ratio: 16 / 9,
|
|
56
|
+
label: "16:9",
|
|
57
|
+
name: "Widescreen",
|
|
58
|
+
desc: "Video, presentations",
|
|
59
|
+
bg: "from-fm-blue-500 to-fm-electricblue-500",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
ratio: 4 / 3,
|
|
63
|
+
label: "4:3",
|
|
64
|
+
name: "Traditional",
|
|
65
|
+
desc: "Classic photos, old TV",
|
|
66
|
+
bg: "from-fm-green-500 to-fm-emerald-500",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
ratio: 3 / 2,
|
|
70
|
+
label: "3:2",
|
|
71
|
+
name: "Photography",
|
|
72
|
+
desc: "35mm film, DSLR",
|
|
73
|
+
bg: "from-fm-red-500 to-fm-yellow-500",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
ratio: 21 / 9,
|
|
77
|
+
label: "21:9",
|
|
78
|
+
name: "Ultra-wide",
|
|
79
|
+
desc: "Cinematic, gaming",
|
|
80
|
+
bg: "from-fm-blue-400 to-fm-secondary-500",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
ratio: 9 / 16,
|
|
84
|
+
label: "9:16",
|
|
85
|
+
name: "Portrait",
|
|
86
|
+
desc: "Mobile, stories, reels",
|
|
87
|
+
bg: "from-fm-hotpink-500 to-fm-primary-500",
|
|
88
|
+
},
|
|
89
|
+
]
|
|
555
90
|
|
|
556
|
-
|
|
557
|
-
export const CommonRatios: Story = {
|
|
91
|
+
export const Configurations: Story = {
|
|
558
92
|
render: () => (
|
|
559
|
-
<div className="
|
|
560
|
-
<
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
<
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
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>
|
|
93
|
+
<div className="space-y-8">
|
|
94
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
95
|
+
Common Aspect Ratios
|
|
96
|
+
</h4>
|
|
97
|
+
<div className="flex flex-wrap justify-center gap-6">
|
|
98
|
+
{COMMON_RATIOS.map((item) => (
|
|
99
|
+
<div key={item.label} className="w-28 space-y-2 text-center">
|
|
100
|
+
<AspectRatio ratio={item.ratio}>
|
|
101
|
+
<div
|
|
102
|
+
className={`flex h-full w-full items-center justify-center rounded-lg bg-linear-to-br ${item.bg}`}
|
|
103
|
+
>
|
|
104
|
+
<span className="bg-fm-surface-primary/80 text-fm-primary rounded px-1.5 py-0.5 text-xs font-bold backdrop-blur-sm">
|
|
105
|
+
{item.label}
|
|
106
|
+
</span>
|
|
107
|
+
</div>
|
|
108
|
+
</AspectRatio>
|
|
109
|
+
<p className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
110
|
+
{item.name}
|
|
111
|
+
</p>
|
|
676
112
|
</div>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
677
115
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
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>
|
|
116
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border p-4">
|
|
117
|
+
<ul className="grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-3">
|
|
118
|
+
{COMMON_RATIOS.map((item) => (
|
|
119
|
+
<li key={item.label} className="flex flex-col gap-0.5">
|
|
120
|
+
<span className="text-fm-primary font-fm-text text-fm-sm leading-fm-sm font-semibold">
|
|
121
|
+
{item.label} — {item.name}
|
|
122
|
+
</span>
|
|
123
|
+
<span className="text-fm-secondary font-fm-text text-fm-sm leading-fm-sm">
|
|
124
|
+
{item.desc}
|
|
125
|
+
</span>
|
|
126
|
+
</li>
|
|
127
|
+
))}
|
|
128
|
+
</ul>
|
|
700
129
|
</div>
|
|
701
130
|
</div>
|
|
702
131
|
),
|
|
703
132
|
parameters: {
|
|
704
|
-
...storyParameters,
|
|
705
133
|
docs: {
|
|
706
134
|
description: {
|
|
707
135
|
story:
|
|
708
|
-
"
|
|
136
|
+
"All common aspect ratios with their visual shape and typical use case.",
|
|
709
137
|
},
|
|
710
138
|
},
|
|
711
139
|
},
|
|
712
140
|
}
|
|
713
141
|
|
|
714
|
-
// 2.
|
|
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>
|
|
142
|
+
// ─── 2. Use Cases ────────────────────────────────────────────────────────────
|
|
728
143
|
|
|
729
|
-
|
|
730
|
-
|
|
144
|
+
export const UseCases: Story = {
|
|
145
|
+
render: () => (
|
|
146
|
+
<div className="mx-auto max-w-3xl space-y-8 p-8">
|
|
147
|
+
{/* Image Gallery */}
|
|
148
|
+
<div className="space-y-4">
|
|
149
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
150
|
+
Image Gallery (1:1)
|
|
151
|
+
</h4>
|
|
152
|
+
<div className="grid grid-cols-3 gap-3 sm:grid-cols-4">
|
|
153
|
+
{Array.from({ length: 8 }).map((_, i) => (
|
|
731
154
|
<div key={i} className="group cursor-pointer">
|
|
732
155
|
<AspectRatio ratio={1}>
|
|
733
|
-
<div
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
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>
|
|
156
|
+
<div
|
|
157
|
+
className={`relative h-full w-full overflow-hidden rounded-lg bg-linear-to-br ${
|
|
158
|
+
[
|
|
159
|
+
"from-fm-hotpink-500 to-fm-primary-500",
|
|
160
|
+
"from-fm-blue-500 to-fm-electricblue-500",
|
|
161
|
+
"from-fm-green-500 to-fm-emerald-500",
|
|
162
|
+
"from-fm-secondary-500 to-fm-hotpink-500",
|
|
163
|
+
][i % 4]
|
|
164
|
+
}`}
|
|
165
|
+
>
|
|
166
|
+
<div className="absolute inset-0 flex items-end justify-start p-1.5">
|
|
167
|
+
<span className="bg-fm-surface-primary/80 text-fm-primary rounded px-1 py-0.5 text-xs font-medium backdrop-blur-sm">
|
|
168
|
+
Image {i + 1}
|
|
169
|
+
</span>
|
|
751
170
|
</div>
|
|
752
171
|
<div className="absolute inset-0 bg-black/20 opacity-0 transition-opacity group-hover:opacity-100" />
|
|
753
172
|
</div>
|
|
@@ -756,234 +175,124 @@ export const ImageGallery: Story = {
|
|
|
756
175
|
))}
|
|
757
176
|
</div>
|
|
758
177
|
</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
178
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
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>
|
|
179
|
+
{/* Video Player */}
|
|
180
|
+
<div className="space-y-4">
|
|
181
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
182
|
+
Video Player (16:9)
|
|
183
|
+
</h4>
|
|
184
|
+
<div className="mx-auto max-w-md">
|
|
185
|
+
<AspectRatio ratio={16 / 9}>
|
|
186
|
+
<div className="bg-fm-surface-secondary relative h-full w-full overflow-hidden rounded-lg">
|
|
187
|
+
<div className="from-fm-surface-secondary to-fm-surface-primary absolute inset-0 bg-linear-to-br" />
|
|
188
|
+
<div className="absolute inset-0 flex items-center justify-center">
|
|
189
|
+
<div className="text-center">
|
|
190
|
+
<div className="text-fm-tertiary mb-2 text-4xl">▶</div>
|
|
191
|
+
<div className="text-fm-primary text-sm font-semibold">
|
|
192
|
+
Widescreen 16:9
|
|
814
193
|
</div>
|
|
815
194
|
</div>
|
|
816
|
-
</
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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>
|
|
195
|
+
</div>
|
|
196
|
+
<div className="absolute right-0 bottom-0 left-0 bg-linear-to-t from-black/60 to-transparent p-3">
|
|
197
|
+
<div className="flex items-center gap-3">
|
|
198
|
+
<div className="bg-fm-surface-tertiary h-1 flex-1 rounded-full">
|
|
199
|
+
<div className="bg-fm-primary-500 h-full w-1/3 rounded-full" />
|
|
837
200
|
</div>
|
|
201
|
+
<span className="text-xs text-white">1:23 / 4:56</span>
|
|
838
202
|
</div>
|
|
839
|
-
</
|
|
203
|
+
</div>
|
|
840
204
|
</div>
|
|
841
|
-
</
|
|
205
|
+
</AspectRatio>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
842
208
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
209
|
+
{/* Product Cards */}
|
|
210
|
+
<div className="space-y-4">
|
|
211
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
212
|
+
Product Cards (4:3)
|
|
213
|
+
</h4>
|
|
214
|
+
<div className="grid grid-cols-3 gap-4">
|
|
215
|
+
{[
|
|
216
|
+
{ icon: "👟", title: "Sneakers", price: "$89" },
|
|
217
|
+
{ icon: "🎧", title: "Headphones", price: "$149" },
|
|
218
|
+
{ icon: "⌚", title: "Watch", price: "$299" },
|
|
219
|
+
].map((product, i) => (
|
|
220
|
+
<div
|
|
221
|
+
key={i}
|
|
222
|
+
className="border-fm-divider-secondary bg-fm-surface-secondary overflow-hidden rounded-xl border"
|
|
223
|
+
>
|
|
224
|
+
<AspectRatio ratio={4 / 3}>
|
|
225
|
+
<div className="bg-fm-surface-primary relative h-full w-full">
|
|
226
|
+
<div className="text-fm-primary absolute inset-0 flex items-center justify-center text-3xl">
|
|
227
|
+
{product.icon}
|
|
862
228
|
</div>
|
|
863
229
|
</div>
|
|
864
230
|
</AspectRatio>
|
|
231
|
+
<div className="p-3">
|
|
232
|
+
<p className="text-fm-primary text-sm font-medium">
|
|
233
|
+
{product.title}
|
|
234
|
+
</p>
|
|
235
|
+
<p className="text-fm-secondary text-sm">{product.price}</p>
|
|
236
|
+
</div>
|
|
865
237
|
</div>
|
|
866
|
-
|
|
238
|
+
))}
|
|
867
239
|
</div>
|
|
868
240
|
</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
241
|
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
<div className="
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
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}>
|
|
242
|
+
{/* Portrait Stories */}
|
|
243
|
+
<div className="space-y-4">
|
|
244
|
+
<h4 className="text-fm-secondary font-fm-text text-fm-md leading-fm-md font-medium">
|
|
245
|
+
Stories & Reels (9:16)
|
|
246
|
+
</h4>
|
|
247
|
+
<div className="flex gap-3">
|
|
248
|
+
{Array.from({ length: 4 }).map((_, i) => (
|
|
249
|
+
<div key={i} className="w-24 shrink-0">
|
|
250
|
+
<AspectRatio ratio={9 / 16}>
|
|
940
251
|
<div
|
|
941
|
-
className={`
|
|
252
|
+
className={`flex h-full w-full flex-col justify-end overflow-hidden rounded-xl bg-linear-to-b p-1.5 ${
|
|
942
253
|
[
|
|
943
|
-
"from-
|
|
944
|
-
"from-
|
|
945
|
-
"from-
|
|
946
|
-
"from-
|
|
947
|
-
|
|
948
|
-
"from-rose-500 to-orange-600",
|
|
949
|
-
][i % 6]
|
|
254
|
+
"from-fm-secondary-500 to-fm-blue-500",
|
|
255
|
+
"from-fm-hotpink-500 to-fm-red-500",
|
|
256
|
+
"from-fm-green-500 to-fm-blue-500",
|
|
257
|
+
"from-fm-red-500 to-fm-secondary-500",
|
|
258
|
+
][i % 4]
|
|
950
259
|
}`}
|
|
951
260
|
>
|
|
952
|
-
<
|
|
953
|
-
|
|
954
|
-
|
|
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" />
|
|
261
|
+
<span className="bg-fm-surface-primary/80 text-fm-primary self-start rounded px-1 py-0.5 text-xs font-medium backdrop-blur-sm">
|
|
262
|
+
@user{i + 1}
|
|
263
|
+
</span>
|
|
959
264
|
</div>
|
|
960
265
|
</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
266
|
</div>
|
|
969
267
|
))}
|
|
970
268
|
</div>
|
|
971
269
|
</div>
|
|
270
|
+
|
|
271
|
+
{/* Usage note */}
|
|
272
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border p-4">
|
|
273
|
+
<p className="text-fm-secondary font-fm-text text-fm-md leading-fm-xl">
|
|
274
|
+
AspectRatio wraps any content and maintains its ratio as the container
|
|
275
|
+
resizes. Use <code>ratio={"{width / height}"}</code> to specify the
|
|
276
|
+
desired proportion. Children must fill 100% width and height using{" "}
|
|
277
|
+
<code>className="h-full w-full"</code>.
|
|
278
|
+
</p>
|
|
279
|
+
</div>
|
|
972
280
|
</div>
|
|
973
281
|
),
|
|
974
282
|
parameters: {
|
|
975
|
-
|
|
283
|
+
layout: "fullscreen",
|
|
976
284
|
docs: {
|
|
977
285
|
description: {
|
|
978
286
|
story:
|
|
979
|
-
"
|
|
287
|
+
"Practical usage examples: image galleries, video players, product cards, and portrait stories.",
|
|
980
288
|
},
|
|
981
289
|
},
|
|
982
290
|
},
|
|
983
291
|
}
|
|
984
292
|
|
|
985
|
-
//
|
|
986
|
-
|
|
293
|
+
// ─── 3. Interactive ──────────────────────────────────────────────────────────
|
|
294
|
+
|
|
295
|
+
export const Interactive: Story = {
|
|
987
296
|
render: () => {
|
|
988
297
|
const [selectedRatio, setSelectedRatio] = React.useState<number | "custom">(
|
|
989
298
|
16 / 9
|
|
@@ -1003,149 +312,93 @@ export const InteractivePlayground: Story = {
|
|
|
1003
312
|
const currentRatio =
|
|
1004
313
|
selectedRatio === "custom" ? customWidth / customHeight : selectedRatio
|
|
1005
314
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
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>
|
|
315
|
+
const currentLabel =
|
|
316
|
+
selectedRatio === "custom"
|
|
317
|
+
? `${customWidth}:${customHeight}`
|
|
318
|
+
: (presetRatios.find((p) => p.value === selectedRatio)?.label ??
|
|
319
|
+
currentRatio.toFixed(2))
|
|
1023
320
|
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
321
|
+
return (
|
|
322
|
+
<div className="w-full p-8">
|
|
323
|
+
<div className="mx-auto max-w-3xl space-y-6">
|
|
324
|
+
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
|
|
325
|
+
{/* Controls panel */}
|
|
326
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary space-y-5 rounded-xl border p-5">
|
|
327
|
+
<p className="text-fm-primary font-fm-brand text-fm-sm leading-fm-sm font-semibold tracking-widest uppercase">
|
|
328
|
+
Presets
|
|
329
|
+
</p>
|
|
330
|
+
<div className="grid grid-cols-2 gap-2">
|
|
331
|
+
{presetRatios.map((preset) => (
|
|
332
|
+
<button
|
|
333
|
+
key={preset.name}
|
|
334
|
+
onClick={() => setSelectedRatio(preset.value)}
|
|
335
|
+
className={`text-fm-sm rounded-lg px-3 py-2 transition-colors ${
|
|
336
|
+
selectedRatio === preset.value
|
|
337
|
+
? "bg-fm-secondary-500 text-white"
|
|
338
|
+
: "bg-fm-surface-primary text-fm-primary hover:bg-fm-surface-tertiary"
|
|
339
|
+
}`}
|
|
340
|
+
>
|
|
341
|
+
{preset.label}
|
|
342
|
+
</button>
|
|
343
|
+
))}
|
|
1044
344
|
</div>
|
|
1045
345
|
|
|
1046
|
-
|
|
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>
|
|
346
|
+
<div className="border-fm-divider-secondary border-t pt-4" />
|
|
1083
347
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
{
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
348
|
+
<p className="text-fm-primary font-fm-brand text-fm-sm leading-fm-sm font-semibold tracking-widest uppercase">
|
|
349
|
+
Custom
|
|
350
|
+
</p>
|
|
351
|
+
<div className="flex items-center gap-2">
|
|
352
|
+
<input
|
|
353
|
+
type="number"
|
|
354
|
+
min="1"
|
|
355
|
+
max="50"
|
|
356
|
+
value={customWidth}
|
|
357
|
+
onChange={(e) => {
|
|
358
|
+
setCustomWidth(Number(e.target.value))
|
|
359
|
+
setSelectedRatio("custom")
|
|
360
|
+
}}
|
|
361
|
+
className="text-fm-sm border-fm-divider-secondary bg-fm-surface-primary text-fm-primary w-16 rounded-lg border px-2 py-2"
|
|
362
|
+
/>
|
|
363
|
+
<span className="text-fm-secondary font-medium">:</span>
|
|
364
|
+
<input
|
|
365
|
+
type="number"
|
|
366
|
+
min="1"
|
|
367
|
+
max="50"
|
|
368
|
+
value={customHeight}
|
|
369
|
+
onChange={(e) => {
|
|
370
|
+
setCustomHeight(Number(e.target.value))
|
|
371
|
+
setSelectedRatio("custom")
|
|
372
|
+
}}
|
|
373
|
+
className="text-fm-sm border-fm-divider-secondary bg-fm-surface-primary text-fm-primary w-16 rounded-lg border px-2 py-2"
|
|
374
|
+
/>
|
|
1098
375
|
</div>
|
|
1099
376
|
</div>
|
|
1100
377
|
|
|
1101
|
-
{/* Preview */}
|
|
1102
|
-
<div className="lg:col-span-2">
|
|
1103
|
-
<div className="
|
|
1104
|
-
<
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
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>
|
|
378
|
+
{/* Preview stage */}
|
|
379
|
+
<div className="flex flex-col gap-3 lg:col-span-2">
|
|
380
|
+
<div className="mx-auto w-full max-w-sm">
|
|
381
|
+
<AspectRatio ratio={currentRatio}>
|
|
382
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary flex h-full w-full items-center justify-center rounded-lg border">
|
|
383
|
+
<div className="text-center">
|
|
384
|
+
<div className="text-fm-primary text-lg font-bold">
|
|
385
|
+
{currentLabel}
|
|
1122
386
|
</div>
|
|
1123
|
-
|
|
1124
|
-
|
|
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>
|
|
387
|
+
<div className="text-fm-tertiary text-xs">
|
|
388
|
+
{currentRatio.toFixed(3)}
|
|
1130
389
|
</div>
|
|
1131
390
|
</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
391
|
</div>
|
|
1148
|
-
</
|
|
392
|
+
</AspectRatio>
|
|
393
|
+
</div>
|
|
394
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary rounded-lg border px-4 py-3">
|
|
395
|
+
<code className="text-fm-md leading-fm-md text-fm-secondary font-[var(--font-fm-mono)]">
|
|
396
|
+
{`<AspectRatio ratio={${currentRatio.toFixed(3)}}>`}
|
|
397
|
+
<br />
|
|
398
|
+
{" {/* your content */}"}
|
|
399
|
+
<br />
|
|
400
|
+
{"</AspectRatio>"}
|
|
401
|
+
</code>
|
|
1149
402
|
</div>
|
|
1150
403
|
</div>
|
|
1151
404
|
</div>
|
|
@@ -1154,173 +407,11 @@ export const InteractivePlayground: Story = {
|
|
|
1154
407
|
)
|
|
1155
408
|
},
|
|
1156
409
|
parameters: {
|
|
1157
|
-
|
|
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,
|
|
410
|
+
layout: "fullscreen",
|
|
1320
411
|
docs: {
|
|
1321
412
|
description: {
|
|
1322
413
|
story:
|
|
1323
|
-
"
|
|
414
|
+
"Interactive playground to experiment with preset and custom aspect ratios.",
|
|
1324
415
|
},
|
|
1325
416
|
},
|
|
1326
417
|
},
|