-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font-family difference between platforms #2648
Conversation
05c670a
to
c826d47
Compare
I think we'll also need these fonts defined in CSS for web/desktop/mobileWeb too right? https://github.com/Expensify/Expensify.cash/blob/main/assets/css/fonts.css Which means that we (on the Expensify side) need to get these fonts uploaded so we can serve them up. |
I'm adding this in this css file, but yeah, we need to upload this font files to be accessible via |
Sounds good, I just sent a pull request on our side for these fonts, they should be available early next week. |
nice, thanks @shawnborton 🎉 |
Do you could send the name of the fonts? @shawnborton I saw that the names is different from the file name, like this one:
|
Yeah, the file names are confusing but if we ignore the file names for a moment, the font family's name is
There should be a corresponding font file for each one of those styles above. Let me know if that makes sense! |
More or less @shawnborton, because it could be a little confused, in the web we use In my opinion a good approach is to use the same name in all platforms (web, android and ios) |
If you need to standardize on a font fame name, I think |
@Thierrysantos To verify, have you tested this on all 5 platforms with the most recent fonts that @shawnborton provided? |
@Luke9389 this changes that @shawnborton made just impact in the web. |
Awesome. Thanks! |
All you @TomatoToaster! |
return ( | ||
<InlineCodeBlock | ||
TDefaultRenderer={TDefaultRenderer} | ||
boxModelStyle={boxModelStyle} | ||
textStyle={textStyle} | ||
textStyle={{...textStyle, ...textStyleOverride}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pass the new styles as Array as per the new StyleGuide. Change the prop type if necessary. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take a look and what this component expect is an object 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I am not sure about the style prop that Internal TDefaultRenderer expect so its fine here. Otherwise you can just change that to array type and see how it works.
src/components/RenderHTML.js
Outdated
@@ -65,11 +68,24 @@ function CodeRenderer({ | |||
// We split wrapper and inner styles | |||
// "boxModelStyle" corresponds to border, margin, padding and backgroundColor | |||
const {boxModelStyle, otherStyle: textStyle} = splitBoxModelStyle(style); | |||
|
|||
const italic = textStyle.fontStyle === 'italic' && fontFamily.MONOSPACE_ITALIC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this logic should be moved to style.js. for Eg
https://github.com/Expensify/Expensify.cash/blob/53acb9ce968a9ea3007302e3debb8b2d9a345ebb/src/styles/styles.js#L1545-L1550
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move to styles.js, but I think that is not necessary, because this logic is specific for <CodeRenderer />
, so in my option is better keep this logic here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We like to keep all the style logic out of JSX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parasharrajat nice, so I will move to styles.js
, thank you 🤘🏽
fontWeight: undefined, | ||
fontStyle: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just set it on the default styles for Code blocks as we are just resetting them unconditionally? Also, a comment saying why undefined
is used would be helpful as I worked over this a little back and these type of changes does not really make sense until specified.
https://github.com/Expensify/Expensify.cash/blob/53acb9ce968a9ea3007302e3debb8b2d9a345ebb/src/styles/styles.js#L1409
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just set it on the default styles for Code blocks as we are just resetting them unconditionally?
No, when the tags (strong, i, b ...) is within a code block, the style from this tags will be merged and passed as text Style
, and with that we can know which font must be used.
If we add undefined
in these properties(font Weight and font Family) in this tags(strong, i, b...), when these tags is inside a code block, we can't know which font must be used.
https://github.com/Expensify/Expensify.cash/blob/7a7fd7d8fc2836c9c2f2a4457776c6ec06407fdc/src/components/RenderHTML.js#L67
Also, a comment saying why undefined is used would be helpful as I worked over this a little back and these type of changes does not really make sense until specified.
I will do this change ❤️
@Thierrysantos Just posted a few friendly concerns. Thanks. |
@parasharrajat Thank you for your review 🤘🏽 |
Yea @parasharrajat, feel free to leave review comments! |
…Weight and fontStyle
@Luke9389 @parasharrajat I update the PR with your suggestions 🤘🏽 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these changes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🚀 Deployed to staging in version: 1.0.39-5🚀
|
🚀 Deployed to production in version: 1.0.39-5🚀
|
Details
This PR fixes the font-family difference between platform
Fixed Issues
#2491
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android