-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixes component info font size #9651
base: main
Are you sure you want to change the base?
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/1165c105f2ab7d768dd6d7f637772f9fdae67840/gradio-5.0.1-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@1165c105f2ab7d768dd6d7f637772f9fdae67840#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/1165c105f2ab7d768dd6d7f637772f9fdae67840/gradio-client-1.6.0.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/1165c105f2ab7d768dd6d7f637772f9fdae67840/dist/lite.js""></script> |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
:global(.md) { | ||
margin-bottom: var(--spacing-lg); | ||
color: var(--block-info-text-color); | ||
font-weight: var(--block-info-text-weight); | ||
font-size: var(--block-info-text-size); | ||
font-weight: var(--block-info-text-weight) !important; | ||
font-size: var(--block-info-text-size) !important; | ||
line-height: var(--line-sm); |
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.
My understanding is that its not good practice to use the !important
here. It would be better to pass in an optional parameter into Markdown
that adjusts the font size to be smaller
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.
Hmm yeah probably not, but the actual font size that I'm overriding is not in the Markdown
component but even lower in the stack in the Embed component. Font size would have to be passed a few time I think, which is probably messy. We use !important
is a bunch of other places too.
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.
Got 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.
Let's avoid introducing !important when easily possible, its a bad practice.
Font size looks good @dawoodkhan82 but previously, we would also use a subdued color for the info text. Compare 4 (top) vs. 5 (bottom), which would be nice to bring back: I also think there should be slightly more padding underneath the info text |
@@ -9,11 +9,11 @@ | |||
</div> | |||
|
|||
<style> | |||
div { | |||
:global(.md) { |
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.
:global is very dangerous and should be avoided when not scoped, this will affect all classes with md. You can scope it to be div > :global(.md)
so it only targets the md inside div.
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.
Lemme take a look at the issue and see if there's a better solution
Use this instead: div > :global(.md.prose) {
color: var(--block-info-text-color);
font-weight: var(--block-info-text-weight);
font-size: var(--block-info-text-size);
line-height: var(--line-sm);
}
div {
margin-bottom: var(--spacing-md);
} Avoids the use of !important, scopes the :global, and the margin bottom wasn't being applied to a span since it's display: inline, so apply it to the div. |
Honestly passing in the style configuration as parameters to the Markdown svelte component is also a fine approach, and is less likely to break in case we change class names in Markdown.svelte. |
Description
info
.Closes: #9642
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh