feat(react-persona): Adding size and textAlignment props and updating styles#25626
Conversation
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 76ebdee7eba4a9decbc1df97f3ff62b7784fdb8f (build) |
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 1330 | 1322 | 5000 | |
| Button | mount | 938 | 955 | 5000 | |
| FluentProvider | mount | 1582 | 1583 | 5000 | |
| FluentProviderWithTheme | mount | 622 | 629 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 588 | 589 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 627 | 624 | 10 | |
| MakeStyles | mount | 1918 | 1917 | 50000 | |
| SpinButton | mount | 2518 | 2545 | 5000 |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b668621:
|
📊 Bundle size report
Unchanged fixtures
|
packages/react-components/react-persona/src/stories/Persona/PersonaPresenceSize.stories.tsx
Outdated
Show resolved
Hide resolved
| return ( | ||
| <div className={styles.root}> | ||
| <Persona | ||
| textAlignment="start" |
There was a problem hiding this comment.
Is text alignment difficult to do without this prop? I'm afraid to start adding props that are just mimicking things we can already do with css.
There was a problem hiding this comment.
Because of this portion of code needed for the text alignment, it is not straightforward. The presence has to be aligned to the primary text when the size is <= large. To achieve this, I am changing the way the grid is working for these sizes. This is needed since the tokens wouldn't align with the top padding needed to align it correctly. If we were to use tokens, we would end up having to do something like this: topPadding: calc(${tokens.verticalSpacingXYZ} + 1px)
// These alignToPrimary styles are needed due to presence being too small to center with the primary text.
alignToPrimary: {
gridTemplateColumns: `max-content [middle] max-content`,
},
afterAlignToPrimary: {
alignSelf: 'center',
gridRowStart: 'unset',
gridColumnEnd: 'middle',
},
beforeAlignToPrimary: {
alignSelf: 'center',
gridRowStart: 'unset',
gridColumnStart: 'middle',
},
packages/react-components/react-persona/src/components/Persona/Persona.types.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/stories/Persona/PersonaAvatarSize.stories.tsx
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts
Outdated
Show resolved
Hide resolved
…ting styles (microsoft#25626) * updating styles and adding size and textAlignment props * final update * cleaning up example * change file * add requested changes * adding requested changes * updating vr-tests * updating tests wrapper * adding requested changes
…ting styles (microsoft#25626) * updating styles and adding size and textAlignment props * final update * cleaning up example * change file * add requested changes * adding requested changes * updating vr-tests * updating tests wrapper * adding requested changes

This PR adds the following:
sizeprop.textAlignmentprop.Related Issue(s)
Fixes #25619