-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Grafana UI: Add code variant to Text component #82318
Conversation
/** The default variant is 'body'. To fit another styles set the correspondent variant as it is necessary also to adjust the icon size. `code` is excluded, as it is not fit for links. */ | ||
variant?: keyof Omit<ThemeTypographyVariantTypes, 'code'>; |
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.
Just my initial thoughts, I can be convinced otherwise
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.
It seems like it makes sense, but just double checking with @staton-hyse11 what his opinion is. We can also remove this Omit
later if we find a use case for it and it won't be a breaking change
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! Do we want to add something to the documentation both in storybook and here about how if developers want to display code they should use this variant?.
/** The default variant is 'body'. To fit another styles set the correspondent variant as it is necessary also to adjust the icon size. `code` is excluded, as it is not fit for links. */ | ||
variant?: keyof Omit<ThemeTypographyVariantTypes, 'code'>; |
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.
It seems like it makes sense, but just double checking with @staton-hyse11 what his opinion is. We can also remove this Omit
later if we find a use case for it and it won't be a breaking change
@@ -29,7 +29,7 @@ interface TextLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 't | |||
} | |||
|
|||
const svgSizes: { | |||
[key in keyof ThemeTypographyVariantTypes]: IconSize; | |||
[key in keyof Omit<ThemeTypographyVariantTypes, 'code'>]: IconSize; |
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.
Could create a type at the top for this. Like type TextLinkVariants = keyof Omit<ThemeTypographyVariantTypes, 'code'>;
and then we could use it both here and in line 23?
I see you point, but I do think we should make a code component (if we don't already have one?) for writing inline code that has some border and highlighting. So in general the So maybe adding the code variant to |
Ignore me, |
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.
Saw this and Dataviz could potentially use this so decided to check it out. Seems to work well!
Hi @tskarhed! |
What is this feature?
Adds a monospaced code variant to make it available in the
Text
component.code
is used as it aligns somewhat with the design tokens.Why do we need this feature?
Sometimes we need to use a monospaced font.
Who is this feature for?
Developers
Special notes for your reviewer:
Please check that: