-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[UI lib] Button, Link & ButtonLink components #7438
Conversation
Gatsby Cloud Build Reportethereum-org-website-dev 🎉 Your build was successful! See the Deploy preview here. Build Details🕐 Build time: 20m |
toId?: string | ||
} | ||
|
||
const Button: React.FC<IProps> = ({ toId, children, ...props }) => { |
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.
I'm calling this component Button
bc it is the same Chakra button but with the scrolling feature. This way, you will just use this button component in the codebase.
import Button from 'components/Button'
On the other hand, we could break them out by calling this component ButtonScroll
and using it only where we need to use the auto-scrolling.
import ButtonScroll from 'components/ButtonScroll'
// for the rest, we use the native chakra button
import Button from 'chakra/Button'
I just wanted to check if you have a preference.
src/components/FeedbackWidget.tsx
Outdated
<Button | ||
variant="outline" | ||
color="primary" | ||
borderColor="primary" |
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.
- TODO: create new variant for this case (is defined in the design system)
throw new Error("Either 'to' or 'href' props must be provided") | ||
} | ||
// TODO: in the next PR we are going to deprecate `to` prop and just use `href` | ||
const to = (toProp || href)! |
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.
In a next PR we are going to just use href
for everything. I didn't want to include that change here since it touches a massive amount of files.
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.
SGTM
@@ -194,7 +194,7 @@ const config: GatsbyConfig = { | |||
{ | |||
resolve: "@chakra-ui/gatsby-plugin", | |||
options: { | |||
resetCSS: false, | |||
resetCSS: true, |
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.
We have enabled the reset from Chakra. It does seem to be working fine so far. I haven't seen any conflict yet.
I got it; it's the box shadow that has to disappear. Screen.Recording.2022-08-30.at.09.48.55.mov |
@nloureiro thanks for the review. re: focus border, I agree that the border is too thick & doesn't look nice on the links. I don't like too much the idea of hiding it until we rethink it. I'll try to copy the previous version to have at least some focus indicator for a11y purposes. re: the other issues:
|
regarding the :focus we should have :focus for accessibility affordance, what do you think about this for now? then I will revisit this on the Design system and open a PR to fix accordantly. |
@pettinarip yeah, I can't reproduce anymore (even without clearing my local storage). I'm not sure what's going on. ==== Re: focus. I don't think the focus style is too much. The weird part is that it is persisting on page transitions. Can we stop that? I also (personally) wouldn't have onClick focus as the most common convention seems to be for keyboard usage only (but I could be wrong here) Edit: This appears to be an issue with Chakra. The problem is resolved in their Storybook.. Bumping Chakra version might solve this? cc: @nloureiro @pettinarip |
@nloureiro I like that style. I'll implement that for now. @minimalsm interesting. Yes, I can confirm it is a v2 improvement. But good for us, we have already a PR opened for that #7617 👍🏼 |
@minimalsm : to reproduce the theme bug
|
Was doing some testing on my end to see if I could replicate any of the themeing issues, but haven't been able to reproduce them on my side. Tested in Safari, Chrome, Brave, and Firefox. |
@nloureiro @minimalsm @corwintines I’ve updated the PR with the new focus style on the Links in order to let you guys see the results. The problem is the inconsistency with other focus styles we have.
I would propose to keep the previous focus styles (the ones we currently have in prod) for the links. To keep it simple for the scope of this PR & for consistency. If you agree then I can modify them to be the same as before. Then, once we have a clear style for the focus in links, we can dedicate a new PR just for that. In summary, my idea is:
|
errr... this is messy. For these reason I agree on keep the production :focus, that is basically no :focus at all. Then we need to discuss how to precess here. |
@@ -755,14 +755,15 @@ const GlobalStyle: React.FC = () => { | |||
/* Anchor tag styles */ | |||
/* Selected specifically for mdx rendered side icon link */ | |||
.header-anchor { | |||
position: relative; | |||
position: relative !important; |
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.
Due to some sort of build order, these styles are being overridden by the default styles that come with the plugin https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-remark-autolink-headers/src/gatsby-ssr.js#L15 thats why I had to put those !important
.
I'll see if I can revert these changes in the #7564 PR.
Cool! I've updated the PR leaving the |
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.
This is what I'm getting now for focus state.
This does not seem like very good for accessibility.
Given that the Chakra update removes the on-click focus and the page transition issue (which I found out is actually strict WCAG, but we don't need to follow IMO), would we be better just keeping the focus styling before the revisions here?
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.
Nice job @pettinarip!
svg { | ||
height: 1.5rem; | ||
&.flip { | ||
transform: scaleY(-1); |
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.
I believe we still need this transform: https://discord.com/channels/714888181740339261/938069231570923550/1019727618666410034
Migration of Button, Link & ButtonLink components.
Description
This PR includes the migration of some core components that are a bit related between them. The PR does not only migrate the components to chakra, it also includes refactors on each one of them.
Notes for the reviewer:
src/@chakra-ui
)Things to test or consider:
Test env: https://ethereumorgwebsitedev01-chakrabuttonlinkcomponent.gtsb.io/
Figma: https://www.figma.com/file/NrNxGjBL0Yl1PrNrOT8G2B/ethereum.org-Design-System
Related Issue
Epic #6374