feat(react-persona): Adding initial implementation#24749
feat(react-persona): Adding initial implementation#24749sopranopillow merged 18 commits intomicrosoft:masterfrom
Conversation
📊 Bundle size report🤖 This report was generated against 615a471e1cab0e63c8d586a49031601f8749c7d6 |
|
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 19eb6ba:
|
Asset size changesUnable to find bundle size details for Baseline commit: 0f74ad4 Possible causes
Recommendations
|
packages/react-components/react-persona/src/components/Persona/usePersonaStyles.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/Persona.test.tsx
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/Persona.types.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/usePersona.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/stories/Persona/PersonaDefault.stories.tsx
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/stories/Persona/PersonaAvatarSize.stories.tsx
Show resolved
Hide resolved
packages/react-components/react-persona/src/stories/Persona/PersonaSizingScaled.stories.tsx
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/usePersona.ts
Outdated
Show resolved
Hide resolved
…ersona-prototype
…ersona-prototype
…ersona-prototype
behowell
left a comment
There was a problem hiding this comment.
Added some comments, but I'm going to approve it so you can merge after addressing them. Thanks!
packages/react-components/react-persona/src/components/Persona/Persona.types.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/Persona.types.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/Persona.types.ts
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/renderPersona.tsx
Outdated
Show resolved
Hide resolved
packages/react-components/react-persona/src/components/Persona/usePersona.ts
Outdated
Show resolved
Hide resolved
| let primaryTextSize; | ||
| let optionalTextSize; | ||
|
|
||
| if (fixed) { |
There was a problem hiding this comment.
The behavior of the fixed/scaling sizing is still a bit more complicated than I would expect. I don't think it should hold up this PR, but we might want to circle back with design to see if we can simplify the behavior there.
My main concern is that there's "magic" behavior around the scaling of the text size when you set the Avatar's size; and that you can't access that same text sizing behavior when you're using auto-sized Avatar.
It seems like instead of tying the Avatar's size to the text size, that Persona itself should have a size prop like small/medium/large, which would be be used to control the text size. Then, the default size of the Avatar would be based on the combination of Persona's size and the number of lines of text (instead of just the number of lines of text like it is today). IMO that would make the API simpler (less magic), and more powerful (more direct control over the text size).
There was a problem hiding this comment.
Another reason I prefer the Persona size prop is that it keeps the "data flow" in one direction: from Persona to Avatar (by having it control the default size). As it is now, the styling of Persona depends on a prop on the avatar slot, which is potentially confusing that the prop on one slot affects other slots.
There was a problem hiding this comment.
Followed up offline; will talk to design and address in a future PR.
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/stories/Persona/PersonaDefault.stories.tsx
Outdated
Show resolved
Hide resolved
| gridAutoColumns: 'max-content', | ||
| gridAutoRows: 'max-content', |
There was a problem hiding this comment.
Out of curiosity, why is max-content needed instead of the default? Do you need it for both columns and rows?
* feat: Adding initial implementation. * updating stories * updating position prop * making Avatar the primary slot * updating tests * adding requested changes * adding final changes * removing grid areas * updating styles * min sync * updating dependencies * updating tests * restoring readme * adding a better description to slots * adding requested changes


This PR adds the initial implementation of Persona.
Note: Styles are still a WIP, this PR is mainly to get the logic down.
Related Issue(s)
Fixes #24640