fix(Icon): Redline matching sizing and spacing of icons in Teams theme#386
fix(Icon): Redline matching sizing and spacing of icons in Teams theme#386codepretty wants to merge 2 commits intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #386 +/- ##
=======================================
Coverage 90.77% 90.77%
=======================================
Files 41 41
Lines 1334 1334
Branches 194 194
=======================================
Hits 1211 1211
Misses 120 120
Partials 3 3
Continue to review full report at Codecov.
|
|
@codepretty, have tried the changes suggested. In the docs it was initially a bit confusing that for Is it fine that icon's area would overlap its neighbour elements? Maybe it would be better to adjust padding size instead of margin. Additional and, probably, more appealing reason is that otherwise we might end up with padding areas of Icons being overlapped for the following case: Now, suppose that these icons are clickable, and clickable area is defined by element's size + padding, but not margin. Thus, with this aligning strategy we will end up with very confusing click areas for the icons: const IconExampleSpace = () => (
<div>
<div style={{ marginBottom: '1.2rem' }}>
<div style={{ display: 'inline-flex', width: '60px', padding: '10px' border: '1px solid', justifyContent: 'space-around' }}>
<Icon name="call" styles={{ background: 'grey' }} />
<Icon name="call-video" styles={{ background: 'yellow' }} />
</div>
</div>
</div>
) |




Update
We've decided to reprocess the Teams SVGs to remove the bounding box. That will change my approach above. Stay tuned as this is on hold until we can process & upload the Teams SVGs
Icons for Teams
For Teams, all icons have a baked in padding. For an icon with a default size the bounding box (viewBox) is 32x32px with a 16x16px icon size.

To get an icon font and Teams SVG assets to line up and be able to work together, we need to add in padding for the font icon.
In addition, if there shouldn't be any visible space, the icon needs to be able to "remove" its bounding box. For this, I have updated the Map to include 2 numbers, the bounding box size and the icon size. I can use this to calculate paddings/spacings in the styles.
By default the icon will show without any space (at least for now since that is what all the other components expect of the icon). However, in order to keep the "pure" SVG, which means to show it with its baked in space (the bounding box), I added

allas a new option to thexSpacingprop. So now we can easily line up a row of icons like thisWith code like this