feat(themes): add FontAwesome theme#1337
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1337 +/- ##
==========================================
+ Coverage 72.2% 72.39% +0.19%
==========================================
Files 769 770 +1
Lines 5777 5749 -28
Branches 1688 1680 -8
==========================================
- Hits 4171 4162 -9
+ Misses 1600 1581 -19
Partials 6 6
Continue to review full report at Codecov.
|
| <Provider | ||
| as={React.Fragment} | ||
| theme={mergeThemes(themes[themeName], { | ||
| theme={mergeThemes(themes.fontAwesome, themes[themeName], { |
There was a problem hiding this comment.
We're using FA on docs, but we don't to have this theme in any other even in base
| render={this.renderElement} | ||
| renderHtml={showCode} | ||
| resolver={importResolver} | ||
| themeName={themeName} |
There was a problem hiding this comment.
This will allow us to access themeName in example components
| // and otherwise produces bad results when border is applied compared to "normal" image | ||
| <Icon | ||
| name="user" | ||
| name="lock" |
There was a problem hiding this comment.
Teams theme doesn't have this icon and font icons will not be supported inside of it
There was a problem hiding this comment.
I am a bit confuse here. We are changing only this icon because Teams' theme doesn't support font icons? What about all other examples like: 'chess rook', 'book' etc. Are we planning to move all examples for now to reflect the Teams' theme icon names?
There was a problem hiding this comment.
We are changing only this icon because Teams' theme doesn't support font icons?
This slot in attachment requires an additional styling for font icons that is not present, so yes.
| styles: { | ||
| ...(isSvgIcon ? styles.svgRoot : styles.fontRoot), | ||
| ...styles.root, | ||
| }, |
There was a problem hiding this comment.
I have to use styles to avoid collisions in generated classes names... The other option is to use generateCSS() directly, but I will need to get renderer from somewhere
| color: v.disabledColor, | ||
| }), | ||
| }), | ||
| fontRoot: ({ props: p, variables: v, theme: t }): ICSSInJSStyle => { |
There was a problem hiding this comment.
Now we have separate roots for SVG and font icons that allows to apply overrides without conditions
There was a problem hiding this comment.
I like that we have two things separated 👍
| mediumSize: string | ||
| largeSize: string | ||
| largerSize: string | ||
| largestSize: string |
There was a problem hiding this comment.
Size values where moved to variables
There was a problem hiding this comment.
Not sure that these size values are general enough for base theme...
There was a problem hiding this comment.
Base theme should support size prop properly and we should avoid nesting in variables. Do you have better proposal? 🐱
There was a problem hiding this comment.
I agree that we should have variables and use this, I was saying about the size values (which now reflect the Teams theme) If you think these values are general and should be defined as this, then I am okay
…rdust-ui/react into feat/fa-theme # Conflicts: # CHANGELOG.md
| export default { | ||
| icons, | ||
| componentStyles, | ||
| } as ThemeInput |
There was a problem hiding this comment.
Can we not expose this theme to the users? Everything is breaking if I choose this one on the Icon's docs. I don't see any benefit for the clients to explore this theme..
|
|
||
| const iconStyles: ComponentSlotStylesInput<IconProps, IconVariables> = { | ||
| fontRoot: (): ICSSInJSStyle => ({ | ||
| fontWeight: 900, // required for the fontAwesome to render |
There was a problem hiding this comment.
It's great that the only required override is actually related to the font awesome icons. I would really like the same thing to be applicable for svgs :)
| // overrides from icon styles | ||
| backgroundColor: 'transparent', | ||
| boxShadow: 'none', | ||
| boxSizing: 'border-box', |
There was a problem hiding this comment.
Shouldn't this be applied by default?? We are using only svg icons and they already have border-box
There was a problem hiding this comment.
Based on offline discussion we decided to add a new icon and use it.
| return { | ||
| display: 'inline-block', | ||
| backgroundColor: v.backgroundColor, | ||
| boxSizing: 'border-box', |
There was a problem hiding this comment.
No need for specifying boxSizing: 'border-box'. Teams theme users only svg icons, and there is no prev definition of 'content-box' (it is for font icons in base theme, not svg)
…rdust-ui/react into feat/fa-theme # Conflicts: # CHANGELOG.md
BREAKING CHANGES
FontAwesome icons is not a part of Teams theme more consider to use SVG icons.
FontAwesome styles were extracted to a separate theme which can be merged with the base for example.
Adds separate roots for font and SVG icons, so styles can be configured independently now without conditions in styles: