Skip to content

feat(react-persona): Adding size and textAlignment props and updating styles#25626

Merged
sopranopillow merged 9 commits intomicrosoft:masterfrom
sopranopillow:persona/styles
Nov 15, 2022
Merged

feat(react-persona): Adding size and textAlignment props and updating styles#25626
sopranopillow merged 9 commits intomicrosoft:masterfrom
sopranopillow:persona/styles

Conversation

@sopranopillow
Copy link
Contributor

This PR adds the following:

  • size prop.
  • textAlignment prop.
  • Updates vr tests for Persona.
  • Removes the scaling functionality.

Related Issue(s)

Fixes #25619

@size-auditor
Copy link

size-auditor bot commented Nov 11, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 76ebdee7eba4a9decbc1df97f3ff62b7784fdb8f (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 11, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 11, 2022

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:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam
Copy link
Collaborator

fabricteam commented Nov 11, 2022

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-persona
Persona
56.299 kB
15.708 kB
57.236 kB
15.976 kB
937 B
268 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
62.951 kB
17.675 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
190.427 kB
53.087 kB
react-components
react-components: FluentProvider & webLightTheme
33.456 kB
11.029 kB
react-portal-compat
PortalCompatProvider
5.857 kB
1.978 kB
🤖 This report was generated against 76ebdee7eba4a9decbc1df97f3ff62b7784fdb8f

return (
<div className={styles.root}>
<Persona
textAlignment="start"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',
  },

@sopranopillow sopranopillow mentioned this pull request Nov 15, 2022
22 tasks
@sopranopillow sopranopillow merged commit 9066dc6 into microsoft:master Nov 15, 2022
@sopranopillow sopranopillow deleted the persona/styles branch November 15, 2022 23:15
NotWoods pushed a commit to NotWoods/fluentui that referenced this pull request Nov 18, 2022
…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
Hotell pushed a commit to Hotell/fluentui that referenced this pull request Feb 9, 2023
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persona: Add size and textAlignment props

5 participants