Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rishy-2021
Copy link

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


@mm-cloud-bot mm-cloud-bot added kind/bug Categorizes issue or PR as related to a bug. release-note labels Aug 25, 2023
@mattermost-build
Copy link
Contributor

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.

@@ -45,7 +45,7 @@ export const getMarkdownTextStyles = makeStyleSheetFromTheme((theme: Theme) => {
},
link: {
color: theme.linkColor,
fontFamily: 'OpenSans',
fontFamily: 'Metropolis',
Copy link
Contributor

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

Copy link
Author

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

@enahum enahum added 2: Dev Review Requires review by a core commiter 2: UX Review Requires review by a UX Designer labels Aug 25, 2023
@@ -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'}}}
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now i memoize textStyles

Copy link
Author

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

@enahum enahum requested a review from larkox August 28, 2023 13:38
const textStyles = getMarkdownTextStyles(theme);
const textStyles = useMemo(() => {
const _textStyles = getMarkdownTextStyles(theme);
return {..._textStyles, link:{..._textStyles.link, fontFamily:'Metropolis'}}
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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.

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@larkox
Copy link
Contributor

larkox commented Sep 25, 2023

@rishy-2021 Are you still working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core commiter 2: UX Review Requires review by a UX Designer Contributor kind/bug Categorizes issue or PR as related to a bug. Lifecycle/1:stale release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants