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

🚚 Move Keyboard Shortcuts #904

Merged
merged 13 commits into from
Oct 10, 2019
Merged

🚚 Move Keyboard Shortcuts #904

merged 13 commits into from
Oct 10, 2019

Conversation

simurai
Copy link
Contributor

@simurai simurai commented Sep 20, 2019

This moves the keyboard shortcuts component from github/github to Primer CSS.

TODO

TODO on .com


Tracking https://github.com/github/design-systems/issues/684

Unchaged from github/.../components/keyboard-shortcuts.scss
@vercel
Copy link

vercel bot commented Sep 20, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://primer-css-git-kbd.primer.now.sh

src/labels/index.scss Outdated Show resolved Hide resolved
@simurai
Copy link
Contributor Author

simurai commented Sep 20, 2019

Can the overrides for .markdown-body be removed? It's pretty much the same, but has slightly different colors:

HTML Screenshot
<kbd>cmd f</kbd> image
<span class="markdown-body"><kbd>cmd f</kbd></span> image

Maybe we should keep it for people that only use the Markdown bundle with

@import "@primer/css/markdown/index.scss";

We could sync up the colors, but not sure if there is some history behind them?

@simurai simurai marked this pull request as ready for review September 21, 2019 12:40
@simurai simurai moved this from Release backlog to Ready to release in 📦 Primer CSS release tracking Sep 21, 2019
This was referenced Sep 21, 2019
@shawnbot
Copy link
Contributor

Can the overrides for .markdown-body be removed? It's pretty much the same, but has slightly different colors:

I would vote yes. The markdown-specific styles don't add much, IMO.

Copy link
Contributor

@shawnbot shawnbot left a comment

Choose a reason for hiding this comment

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

This is great. I'm honestly not sure what the "right" thing is to do about the Markdown-specific styles, though. Our options appear to be:

  1. Delete the .markdown-body kbd styles altogether. This assumes that anyone using the markdown bundle is also using core, but I guess if this were to break for somebody we could just tell them to add an import?
  2. Add an @import "../labels/keyboard-shortcuts.scss"; inside the .markdown-body {} block so that the styles are duplicated, but still available in the standalone markdown bundle.

Am I missing something?

@shawnbot
Copy link
Contributor

I also think it might make sense to call this file kbd.scss rather than keyboard-shortcuts.scss.

@simurai
Copy link
Contributor Author

simurai commented Sep 26, 2019

I also think it might make sense to call this file kbd.scss rather than keyboard-shortcuts.scss.

Would make sense since we style the element directly. Was also thinking if it should be part of base.scss? But then it can't be found when clicking on "View source" in the docs.

ok, yeah.. let's change it to kbd.scss.


Markdown-specific styles

Hmmm.. with option 1, looks like we would have to import it for mobile and embedded gists?

But that's only for github/github. There might be lots more..? Also Primer CSS users outside of GitHub. So maybe try option 2. At least we can avoid maintaining it in two places. ✨

@simurai
Copy link
Contributor Author

simurai commented Sep 26, 2019

Add an @import "../labels/keyboard-shortcuts.scss"; inside the .markdown-body {} block so that the styles are duplicated, but still available in the standalone markdown bundle.

Hmm.. now I'm not sure anymore... 😆

It feels a bit weird having the markdown bundle import from the labels bundle.

Option 3:

Treat <kbd> styling the same as we currently treat <hr>s. They have default styling in base.scss that gets overridden in .markdown-body. I'll already make the change to get a feel for it.

Then in the future we can consider turning <kbd> and <hr> (and maybe more?) into "real" components, that get their own class name, like .KeyboardShortcut and .Divider or similar.

@vercel vercel bot temporarily deployed to staging September 26, 2019 06:54 Inactive
@shawnbot
Copy link
Contributor

I like how you handled this, @simurai. I think we can remove most (all?) of the styles from .markdown-body if it's in base, as much of the Markdown styles rely on base anyway.

@simurai
Copy link
Contributor Author

simurai commented Sep 27, 2019

Hmm.. I think we have to keep the kbd styles in .markdown-body because on mobile, we use a custom base.scss and for embedded gists we don't import any base styles.

src/base/base.scss Outdated Show resolved Hide resolved
@simurai
Copy link
Contributor Author

simurai commented Oct 1, 2019

Ok, the markdown kbd has now the exact same values as in base: 8d2952f. It will slightly change in color, but not too drastic. It also has the mono font stack added.

Made a "reminder" issue to consider removing kbd from markdown: #919

@simurai simurai requested a review from shawnbot October 1, 2019 02:02
@shawnbot
Copy link
Contributor

shawnbot commented Oct 1, 2019

Okay I'm sorry @simurai, but now that they're exactly the same I think we should move the styles into src/base/kbd.scss and use @import for both instances. This gives it the stature of a component, provides us with a single source of truth, and prevents the appearance from diverging.

@simurai
Copy link
Contributor Author

simurai commented Oct 2, 2019

should move the styles into src/base/kbd.scss and use @import for both instances.

ok, yeah.. it felt wrong importing from /labels into the markdown bundle. Importing from /base should be fine. 👍

@shawnbot shawnbot mentioned this pull request Oct 3, 2019
19 tasks
@shawnbot shawnbot changed the base branch from master to release-14.0.0 October 3, 2019 21:40
Copy link
Contributor

@shawnbot shawnbot left a comment

Choose a reason for hiding this comment

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

Huzzah, this is great! I suppose it doesn't really need docs of its own for now, right?

@shawnbot
Copy link
Contributor

shawnbot commented Oct 3, 2019

It looks like in its current state this also closes #919, right?

@simurai
Copy link
Contributor Author

simurai commented Oct 4, 2019

I suppose it doesn't really need docs of its own for now, right?

Maybe not, unless we wanna document all the base styles.

It looks like in its current state this also closes #919, right?

Hmmm.. well, now that it's part of a major release, we could remove it from the markdown bundle. 🤔 But it's also nice being able to only import the markdown bundle and having support for <kbd>s already included. So I'm fine with closing #919 as is.

@shawnbot
Copy link
Contributor

shawnbot commented Oct 7, 2019

@simurai I opened #935 for a minor release before 14.0.0, so feel free to merge this there if you want to get it out sooner. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants