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