-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix link within heading font #7521
base: main
Are you sure you want to change the base?
Conversation
Hello @rishy-2021, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. |
app/utils/markdown/index.ts
Outdated
@@ -45,7 +45,7 @@ export const getMarkdownTextStyles = makeStyleSheetFromTheme((theme: Theme) => { | |||
}, | |||
link: { | |||
color: theme.linkColor, | |||
fontFamily: 'OpenSans', | |||
fontFamily: 'Metropolis', |
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.
this is not the proper fix, as a link in normal paragraph will now use Metropolis instead of openSans
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.
Sorry, i misunderstood the code , now only the heading link font is Metropolis
@@ -94,7 +94,7 @@ const Message = ({currentUser, highlight, isEdited, isPendingOrFailed, isReplyPo | |||
layoutWidth={layoutWidth} | |||
location={location} | |||
postId={post.id} | |||
textStyles={textStyles} | |||
textStyles={{...textStyles, link:{...textStyles.link, fontFamily:'Metropolis'}}} |
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.
If this is done you should Memoize it.
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.
now i memoize textStyles
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.
@enahum is there anything left for me to change
const textStyles = getMarkdownTextStyles(theme); | ||
const textStyles = useMemo(() => { | ||
const _textStyles = getMarkdownTextStyles(theme); | ||
return {..._textStyles, link:{..._textStyles.link, fontFamily:'Metropolis'}} |
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.
Isn't this making all links (including those in the body) use Metropolis
?
Also, I just saw the problem may be a bit more deep, since I can also reproduce the issue with something like ## heading **heading**
. Also, this one would solve it only for the post, but anywhere else markdown may be used (like post attachments) will be broken also.
I guess the issue is in part with computeTextStyle
in app/utils/markdown/index.ts
and in part with getMarkdownTextStyles
in the same file.
Some juggling may be needed, but I feel in most of the places the fontFamily
should not be there, and be inherited from the parent, but 0/5 on the details.
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.
Oh very good points @larkox I do agree with you.. maybe we just need to add new styles for markdown as we have headingXText
we could do the same for headingXLink
where X
is the number of the heading
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.
confirming that this indeed does make all link text use Metropolis
. Let me know when this is updated and I can review again @rishy-2021
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.
The problem of adding a headingLink
is that then you have to add one for each variation (take in mind that my example was no longer a heading link, but a bolded heading.
This should be solved in a more holistic way, hopefully trusting inheritance of styles.
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
@rishy-2021 Are you still working on this? |
Summary
change link font to Metropolis from OpenSans
Ticket Link
https://mattermost.atlassian.net/browse/MM-53978
Device Information
This PR was tested on: Realme GT2, realme UI 4.0 | Android 13
Release Note
NA