-
Notifications
You must be signed in to change notification settings - Fork 461
feat(ui): Add a Mosaic scroll area with scroll-driven edge fades #9312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4ee6ad4
49ead2a
29d28db
1a66945
3d9408e
9b2c996
74b5793
0c77987
0756b4b
58f0a2e
7bce202
21cdf7b
007de24
fa25346
a32746c
041f7a9
9ca546c
afa09e2
c8cde2b
1b2c81c
78dee07
cef0fc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
| import { Avatar } from '@clerk/ui/mosaic/components/avatar'; | ||
| import { Button } from '@clerk/ui/mosaic/components/button'; | ||
| import { Item } from '@clerk/ui/mosaic/components/item'; | ||
| import { scrollAreaRoot, scrollAreaViewport } from '@clerk/ui/mosaic/components/scroll-area'; | ||
| import { radiusVars } from '@clerk/ui/mosaic/styles'; | ||
| import * as stylex from '@stylexjs/stylex'; | ||
| import * as React from 'react'; | ||
|
|
||
| import type { StoryMeta } from '@/lib/types'; | ||
|
|
@@ -332,3 +335,68 @@ export function Group() { | |
| </div> | ||
| ); | ||
| } | ||
|
|
||
| const organizations = [ | ||
| 'Clerk', | ||
| 'Acme Corporation', | ||
| 'Globex', | ||
| 'Initech', | ||
| 'Umbrella Health', | ||
| 'DesignCloud', | ||
| 'Stark Industries', | ||
| 'Wayne Enterprises', | ||
| 'Cyberdyne Systems', | ||
| 'Soylent Industries', | ||
| 'Tyrell Corporation', | ||
| 'Weyland-Yutani', | ||
| ]; | ||
|
|
||
| // `Item.Group` is the canonical scroll surface, so this shows the atoms doing the minimum: cap a | ||
| // height, spread them on, and the group fades its own edges. The Scroll Area page under Styles | ||
| // carries the full surface — the gutter argument, the resting state, and the theming tokens. | ||
| export function Scrolling() { | ||
| // `stylex.props()` returns a `className`, so it has to be MERGED with any class of your own | ||
| // rather than spread beside one — whichever comes last in JSX wins outright. | ||
| const root = stylex.props(scrollAreaRoot); | ||
|
|
||
| return ( | ||
| <div | ||
| {...root} | ||
| className={`${root.className} border-border w-full border`} | ||
| style={{ height: 200, borderRadius: radiusVars['--cl-radius-inner'] }} | ||
| > | ||
| <Item.Group {...stylex.props(...scrollAreaViewport())}> | ||
| {organizations.map(name => ( | ||
| <Item.Root | ||
| key={name} | ||
| size='xs' | ||
| render={({ children, ...props }) => ( | ||
| <button | ||
| {...props} | ||
| type='button' | ||
| > | ||
| {children} | ||
| </button> | ||
| )} | ||
| > | ||
| <Item.Media> | ||
| <Avatar.Root | ||
| size='fit' | ||
| shape='square' | ||
| > | ||
| <Avatar.Image | ||
| src='https://github.com/clerk.png' | ||
| alt={name} | ||
| /> | ||
|
Comment on lines
+387
to
+390
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Avoid duplicating the organization name in the accessible label.
🤖 Prompt for AI Agents |
||
| <Avatar.Fallback>{name[0]}</Avatar.Fallback> | ||
| </Avatar.Root> | ||
| </Item.Media> | ||
| <Item.Content> | ||
| <Item.Title>{name}</Item.Title> | ||
| </Item.Content> | ||
| </Item.Root> | ||
| ))} | ||
| </Item.Group> | ||
| </div> | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: clerk/javascript
Length of output: 10068
🏁 Script executed:
Repository: clerk/javascript
Length of output: 12457
Register the missing
ShadowIndicatorsstory.scroll-area.stories.tsxexportsShadowIndicators, butregistry.tsimports and registers only the other five scroll area stories. AddShadowIndicatorsto both the import andscrollAreaModulesolib/registry.tsremains the single source of truth for the story components.🤖 Prompt for AI Agents
Source: Path instructions