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

Change inline code styling. #1203

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

Change inline code styling. #1203

wants to merge 7 commits into from

Conversation

sfc-gh-tteixeira
Copy link
Contributor

📚 Context

🧠 Description of Changes

Revised:

Insert screenshot of your updated UI/code here

Current:

Insert screenshot of existing UI/code here

💥 Impact

Size:

  • Small
  • Not small

🌐 References

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@sfc-gh-tteixeira
Copy link
Contributor Author

Example pages to check:

  • /develop/api-reference/data/st.dataframe
  • /get-started/installation/command-line
  • /develop/api-reference/media/st.logo (see link)

@sfc-gh-tteixeira sfc-gh-tteixeira marked this pull request as ready for review December 16, 2024 22:00
styles/text.scss Outdated
Comment on lines 121 to 128
/* Improve `code` links. Don't use border, use underline instead. */
p > a:has(tt.docutils.literal) {
@apply border-0;
}

/* Improve `code` links. Don't use border, use underline instead. */
p > a > tt.docutils.literal {
@apply underline;
Copy link
Contributor

@sfc-gh-dmatthews sfc-gh-dmatthews Dec 16, 2024

Choose a reason for hiding this comment

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

If we use underline, commands with underscores will look like this:
image

Also, the site uses border for links elsewhere, so if we do switch it, we have other styling to correct too. This is what the preview currently shows:

A link in the function description of st.logo:
image

An inline-code link in the class description of SQLConnection:
image

Links from the connections concept page (both standard and inline code):
image

The only links thatve been changed are inline code links within a parameter description, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd vote for leaving it as a border to be consistent across all links and just modify the color if that's what you want. Though I'd be a little confused by the color scheme if we make it a green underline for code (to always match the text color), then how do we handle the hover effect. We currently hover black -> red for the bottom border on links, but green -> red feels....seasonal. 😅

Copy link
Contributor Author

@sfc-gh-tteixeira sfc-gh-tteixeira Dec 16, 2024

Choose a reason for hiding this comment

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

For regular links we'll continue to use the existing design. What we're changing here is the design of links inside inline code.

So from your examples, only the SQL Connection example will be impacted by this PR. The rest will stay the same.

Copy link
Contributor

@sfc-gh-dmatthews sfc-gh-dmatthews Dec 16, 2024

Choose a reason for hiding this comment

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

In the connecting to data article, st.connection is also inline code; it's just not inline code within Autofunction. Do you mean to exclude that as well?

@sfc-gh-dmatthews
Copy link
Contributor

Tips, Info, Warning: e.g. https://deploy-preview-1203--streamlit-docs.netlify.app/develop/concepts/multipage-apps/overview
image

So we have inline code is green except:

  • Inline code in headers is black
  • Inline code with links in MarkDown (not AutoFunction) is black with a bottom border (matches non-inline-code links)
  • Inline code with links in AutoFunciton are green underlined

Is that the correct intent?

@sfc-gh-dmatthews
Copy link
Contributor

Similarly for deprecation/note blocks within Autofunction, can you confirm if this is how you want the background colors to look?
image
image

styles/text.scss Outdated
Comment on lines 121 to 130
/* Improve `code` links. Don't use border, use underline instead. */
a:has(tt:only-child),
a:has(code:only-child) {
@apply border-0;
}

/* Improve `code` links. Don't use border, use underline instead. */
a > tt:only-child,
a > code:only-child {
@apply underline;
Copy link
Contributor

Choose a reason for hiding this comment

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

Inline code links outside of Autofunction have double underline in default text color:
image

Inline code links in Autofunction (function or class description; not parameter description) have a double underline (underline is green, border is default text color)
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great finds! Should be fixed now.

@sfc-gh-dmatthews
Copy link
Contributor

This link contains inline code but isn't entirely inline code. Do we just declare that I can't do that anymore since we're using different underlines for code and non-code?

image

@sfc-gh-tteixeira
Copy link
Contributor Author

No, that should be allowed. The problem here seems to be that :only-child doesn't count text nodes as children -- weird! So we'll have to look for another solution...

@sfc-gh-tteixeira
Copy link
Contributor Author

Ok, I tried different solutions but nothing look good. Reverting to the way links used to look.

I don't love it, but it's the best we can do in short notice.

Screenshot 2024-12-17 at 15 53 43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants