Repository navigation
refactor(mosaic): share media sizes and radii between IconFrame and Avatar #10600
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
Changes from all commits
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,5 @@ | ||
| --- | ||
| '@clerk/mosaic': patch | ||
| --- | ||
|
|
||
| `IconFrame` and `Avatar` now share one size scale and set of corner radii: `xs`, `sm`, `md` and `lg` are 24, 32, 40 and 48px. `IconFrame` sizes are now `xs`, `sm`, `md` and `lg` and the default is `md` (40px), replacing `sm`, `md`, `lg` and `xl`. `Avatar` `md` is 40px instead of 38px, square `Avatar` at `md` has a 6px radius instead of 8px, and provider icons in the connected accounts, enterprise accounts and Web3 wallets sections are 16px instead of 20px. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,41 +85,21 @@ export const styles = stylex.create({ | |
| }, | ||
| }); | ||
|
|
||
| // shape — square takes the radius its size sets below; circle rounds fully | ||
| // shape — square takes the radius its size sets (see `mediaSizes`); circle rounds fully | ||
| export const shapes = stylex.create({ | ||
| circle: { borderRadius: radiusVars['--cl-radius-full'] }, | ||
| square: { borderRadius: 'var(--_cl-avatar-radius)' }, | ||
| square: { borderRadius: 'var(--_cl-media-radius)' }, | ||
|
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.
|
||
| }); | ||
|
|
||
| // size — square box; font-size is ~0.4x the box, the ceiling at which two initials still clear | ||
| // the circle's clip. | ||
| // size — the box and radius come from `mediaSizes`; font-size is ~0.4x the box, the ceiling at which | ||
| // two initials still clear the circle's clip. | ||
| export const sizes = stylex.create({ | ||
| xs: { | ||
| '--_cl-avatar-radius': radiusVars['--cl-radius-sm'], | ||
| fontSize: '0.625rem', | ||
| height: space['6'], | ||
| width: space['6'], | ||
| }, | ||
| sm: { | ||
| '--_cl-avatar-radius': radiusVars['--cl-radius-md'], | ||
| fontSize: '0.8125rem', | ||
| height: space['8'], | ||
| width: space['8'], | ||
| }, | ||
| md: { | ||
| '--_cl-avatar-radius': radiusVars['--cl-radius-lg'], | ||
| fontSize: '0.9375rem', | ||
| height: space['9.5'], | ||
| width: space['9.5'], | ||
| }, | ||
| lg: { | ||
| '--_cl-avatar-radius': radiusVars['--cl-radius-lg'], | ||
| fontSize: '1.125rem', | ||
| height: space['12'], | ||
| width: space['12'], | ||
| }, | ||
| xs: { fontSize: '0.625rem' }, | ||
| sm: { fontSize: '0.8125rem' }, | ||
| md: { fontSize: '0.9375rem' }, | ||
| lg: { fontSize: '1.125rem' }, | ||
| fit: { | ||
| '--_cl-avatar-radius': radiusVars['--cl-radius-md'], | ||
| '--_cl-media-radius': radiusVars['--cl-radius-md'], | ||
| fontSize: '0.75rem', | ||
| height: '100%', | ||
| width: '100%', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import * as stylex from '@stylexjs/stylex'; | ||
|
|
||
| import { radiusVars, space } from '../tokens.stylex'; | ||
|
|
||
| export const mediaSizes = stylex.create({ | ||
| xs: { | ||
| '--_cl-media-radius': radiusVars['--cl-radius-sm'], | ||
| height: space['6'], | ||
| width: space['6'], | ||
| }, | ||
| sm: { | ||
| '--_cl-media-radius': radiusVars['--cl-radius-md'], | ||
| height: space['8'], | ||
| width: space['8'], | ||
| }, | ||
| md: { | ||
| '--_cl-media-radius': radiusVars['--cl-radius-md'], | ||
| height: space['10'], | ||
| width: space['10'], | ||
| }, | ||
| lg: { | ||
| '--_cl-media-radius': radiusVars['--cl-radius-lg'], | ||
| height: space['12'], | ||
| width: space['12'], | ||
| }, | ||
| }); |
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.
Script executed:
Repository: clerk/javascript
Length of output: 30111
Script executed:
Repository: clerk/javascript
Length of output: 42150
Script executed:
Repository: clerk/javascript
Length of output: 35157
Publish this breaking
IconFramechange as a minor release.IconFramePropsis publicly exported, but the changeset currently declares a patch release even though it removes the supportedxlvalue and changes the meanings and default of existing values. Consumers usingsize='xl'can fail TypeScript compilation, while consumers using existing values can receive different frame sizes. The README and changelog precedent place breaking Mosaic API changes in minor releases.Suggested fix
Committable suggestion