refactor(PresenceBadge): Remove props and return correct presence icons#20630
refactor(PresenceBadge): Remove props and return correct presence icons#20630ling1726 merged 10 commits intomicrosoft:masterfrom
Conversation
The presence icons in `@fluentui/react-icons` are actually the presence badge content. In order to use these icons correctly, this PR: * Restricts props to `size` `status` `outOfOffice` * Removes the icon slot since custom icons are not a part of the design * Does not use normal badge styles * Returns the correct sized icon
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 5eeb89fcd561fa9ac8193260774cdab4dcf90171 (build) |
|
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 3c7cc20:
|
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 742 | 801 | 5000 | |
| BaseButton | mount | 792 | 771 | 5000 | |
| Breadcrumb | mount | 2308 | 2278 | 1000 | |
| ButtonNext | mount | 448 | 441 | 5000 | |
| Checkbox | mount | 1282 | 1299 | 5000 | |
| CheckboxBase | mount | 1113 | 1106 | 5000 | |
| ChoiceGroup | mount | 4054 | 3948 | 5000 | |
| ComboBox | mount | 1122 | 841 | 1000 | |
| CommandBar | mount | 8672 | 8533 | 1000 | |
| ContextualMenu | mount | 7152 | 7202 | 1000 | |
| DefaultButton | mount | 984 | 976 | 5000 | |
| DetailsRow | mount | 3079 | 3217 | 5000 | |
| DetailsRowFast | mount | 3254 | 3120 | 5000 | |
| DetailsRowNoStyles | mount | 3100 | 3148 | 5000 | |
| Dialog | mount | 2151 | 2185 | 1000 | |
| DocumentCardTitle | mount | 143 | 147 | 1000 | |
| Dropdown | mount | 2719 | 2757 | 5000 | |
| FluentProviderNext | mount | 3559 | 3410 | 5000 | |
| FluentProviderWithTheme | mount | 186 | 220 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 89 | 87 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 217 | 233 | 10 | |
| FocusTrapZone | mount | 1409 | 1393 | 5000 | |
| FocusZone | mount | 1545 | 1553 | 5000 | |
| IconButton | mount | 1509 | 1501 | 5000 | |
| Label | mount | 306 | 265 | 5000 | |
| Layer | mount | 2487 | 2433 | 5000 | |
| Link | mount | 411 | 431 | 5000 | |
| MakeStyles | mount | 1523 | 1614 | 50000 | |
| MenuButton | mount | 1194 | 1228 | 5000 | |
| MessageBar | mount | 1566 | 1718 | 5000 | |
| Nav | mount | 2892 | 2814 | 1000 | |
| OverflowSet | mount | 957 | 977 | 5000 | |
| Panel | mount | 2148 | 2065 | 1000 | |
| Persona | mount | 660 | 725 | 1000 | |
| Pivot | mount | 1215 | 1238 | 1000 | |
| PrimaryButton | mount | 1093 | 1067 | 5000 | |
| Rating | mount | 6464 | 6295 | 5000 | |
| SearchBox | mount | 1119 | 1147 | 5000 | |
| Shimmer | mount | 1998 | 2141 | 5000 | |
| Slider | mount | 1541 | 1689 | 5000 | |
| SpinButton | mount | 4072 | 4151 | 5000 | |
| Spinner | mount | 340 | 341 | 5000 | |
| SplitButton | mount | 2699 | 2620 | 5000 | |
| Stack | mount | 452 | 450 | 5000 | |
| StackWithIntrinsicChildren | mount | 1455 | 1451 | 5000 | |
| StackWithTextChildren | mount | 3875 | 3782 | 5000 | |
| SwatchColorPicker | mount | 8805 | 8820 | 5000 | |
| TagPicker | mount | 2239 | 2219 | 5000 | |
| TeachingBubble | mount | 10986 | 10977 | 5000 | |
| Text | mount | 379 | 384 | 5000 | |
| TextField | mount | 1218 | 1205 | 5000 | |
| ThemeProvider | mount | 975 | 1020 | 5000 | |
| ThemeProvider | virtual-rerender | 533 | 529 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 1453 | 1457 | 5000 | |
| Toggle | mount | 700 | 695 | 5000 | |
| buttonNative | mount | 116 | 108 | 5000 |
Perf Analysis (@fluentui/react-northstar)
Perf tests with no regressions
| Scenario | Current PR Ticks | Baseline Ticks | Ratio |
|---|---|---|---|
| InputMinimalPerf.default | 2642 | 1032 | 2.56:1 |
| ButtonMinimalPerf.default | 154 | 128 | 1.2:1 |
| PortalMinimalPerf.default | 154 | 135 | 1.14:1 |
| AccordionMinimalPerf.default | 122 | 108 | 1.13:1 |
| ButtonSlotsPerf.default | 478 | 423 | 1.13:1 |
| FlexMinimalPerf.default | 248 | 220 | 1.13:1 |
| CustomToolbarPrototype.default | 3869 | 3494 | 1.11:1 |
| SliderMinimalPerf.default | 1472 | 1334 | 1.1:1 |
| CardMinimalPerf.default | 482 | 442 | 1.09:1 |
| ChatMinimalPerf.default | 565 | 516 | 1.09:1 |
| TextAreaMinimalPerf.default | 417 | 381 | 1.09:1 |
| CheckboxMinimalPerf.default | 2248 | 2081 | 1.08:1 |
| TextMinimalPerf.default | 311 | 289 | 1.08:1 |
| AnimationMinimalPerf.default | 364 | 341 | 1.07:1 |
| ChatWithPopoverPerf.default | 331 | 310 | 1.07:1 |
| DropdownMinimalPerf.default | 2468 | 2298 | 1.07:1 |
| SkeletonMinimalPerf.default | 305 | 287 | 1.06:1 |
| BoxMinimalPerf.default | 307 | 291 | 1.05:1 |
| ListWith60ListItems.default | 577 | 551 | 1.05:1 |
| AttachmentMinimalPerf.default | 140 | 134 | 1.04:1 |
| AttachmentSlotsPerf.default | 920 | 888 | 1.04:1 |
| HeaderMinimalPerf.default | 315 | 303 | 1.04:1 |
| ListNestedPerf.default | 477 | 459 | 1.04:1 |
| SegmentMinimalPerf.default | 263 | 254 | 1.04:1 |
| TreeWith60ListItems.default | 161 | 155 | 1.04:1 |
| AvatarMinimalPerf.default | 172 | 167 | 1.03:1 |
| TableManyItemsPerf.default | 1578 | 1529 | 1.03:1 |
| FormMinimalPerf.default | 316 | 309 | 1.02:1 |
| ItemLayoutMinimalPerf.default | 993 | 970 | 1.02:1 |
| IconMinimalPerf.default | 513 | 504 | 1.02:1 |
| ToolbarMinimalPerf.default | 728 | 716 | 1.02:1 |
| ButtonOverridesMissPerf.default | 1444 | 1429 | 1.01:1 |
| ChatDuplicateMessagesPerf.default | 262 | 259 | 1.01:1 |
| LoaderMinimalPerf.default | 590 | 582 | 1.01:1 |
| PopupMinimalPerf.default | 518 | 515 | 1.01:1 |
| TooltipMinimalPerf.default | 883 | 874 | 1.01:1 |
| GridMinimalPerf.default | 263 | 262 | 1:1 |
| ProviderMinimalPerf.default | 914 | 918 | 1:1 |
| ReactionMinimalPerf.default | 321 | 322 | 1:1 |
| TableMinimalPerf.default | 348 | 347 | 1:1 |
| VideoMinimalPerf.default | 533 | 534 | 1:1 |
| DatepickerMinimalPerf.default | 4719 | 4760 | 0.99:1 |
| DividerMinimalPerf.default | 287 | 291 | 0.99:1 |
| EmbedMinimalPerf.default | 3391 | 3436 | 0.99:1 |
| HeaderSlotsPerf.default | 614 | 618 | 0.99:1 |
| RadioGroupMinimalPerf.default | 377 | 379 | 0.99:1 |
| SplitButtonMinimalPerf.default | 3551 | 3584 | 0.99:1 |
| MenuMinimalPerf.default | 669 | 685 | 0.98:1 |
| RosterPerf.default | 991 | 1014 | 0.98:1 |
| DialogMinimalPerf.default | 610 | 632 | 0.97:1 |
| MenuButtonMinimalPerf.default | 1273 | 1310 | 0.97:1 |
| ImageMinimalPerf.default | 310 | 323 | 0.96:1 |
| ListCommonPerf.default | 511 | 536 | 0.95:1 |
| ProviderMergeThemesPerf.default | 1395 | 1470 | 0.95:1 |
| TreeMinimalPerf.default | 648 | 684 | 0.95:1 |
| LabelMinimalPerf.default | 305 | 326 | 0.94:1 |
| LayoutMinimalPerf.default | 291 | 309 | 0.94:1 |
| CarouselMinimalPerf.default | 395 | 430 | 0.92:1 |
| ListMinimalPerf.default | 398 | 435 | 0.91:1 |
| RefMinimalPerf.default | 184 | 202 | 0.91:1 |
| DropdownManyItemsPerf.default | 522 | 580 | 0.9:1 |
| StatusMinimalPerf.default | 507 | 567 | 0.89:1 |
packages/react-badge/src/components/PresenceBadge/usePresenceBadgeStyles.ts
Show resolved
Hide resolved
behowell
left a comment
There was a problem hiding this comment.
I approved the Avatar screener changes, but had some questions about others:
- The new RTL badge tests appear to be clipped; is it a bug in the test?
- Why is there a change in "Button (compat): Root - RTL: hover" ?
| "react-test-renderer": "^16.3.0" | ||
| }, | ||
| "dependencies": { | ||
| "@fluentui/react-icons": "^1.1.140", |
There was a problem hiding this comment.
I would recommend using version 2.0.151-beta.2. This has the resizable icons and fixes some minor visual regressions
There was a problem hiding this comment.
So either you would need to get your PR to bump to v2-beta for react-icons first or add the changes from this PR to yours
either works
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
…ns (microsoft#20630) * refactor(PresenceBadge): Remove props and return correct presence icons The presence icons in `@fluentui/react-icons` are actually the presence badge content. In order to use these icons correctly, this PR: * Restricts props to `size` `status` `outOfOffice` * Removes the icon slot since custom icons are not a part of the design * Does not use normal badge styles * Returns the correct sized icon * Change files * reuse badge internals where possible * tests * fix lint * Update avatar snapshots * Change files * update styles * add thinBorder style, removed by mistake * style fixes
Pull request checklist
PresenceBadgeto use presence icons #20627 Fixes Incorrect icons being used in presence badges #20191 Fixes vNext Presence badge icon line weight for Offline inconsistent with other presence badges #20180$ yarn changeDescription of changes
The presence icons in
@fluentui/react-iconsare actually the presencebadge content. In order to use these icons correctly, this PR:
sizestatusoutOfOfficeThe
PresenceBadgecomponent is essentially a badge with a non-configurableiconslot and reduced props and different styling, but follows the standardBadgeDOM structure and state.Focus areas to test
(optional)