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

RNA buttons: add styles and storybook documentation #21496

Closed
wants to merge 15 commits into from

Conversation

keoshi
Copy link
Contributor

@keoshi keoshi commented Oct 21, 2021

Changes proposed in this Pull Request:

  • Add color variables.
  • Add overriding styles for the @wordpress/components buttons.
  • Added a documentation page in Storybook.

Jetpack product discussion

p6TEKc-5rF-p2

Does this pull request change what data or activity we track or use?

No

Testing instructions for Storybook:

  • Go to the Storybook folder cd projects/js-packages/storybook
  • Run pnpm install
  • Run pnpm run storybook:dev
  • Storybook should open in your browser.
  • Go to Components → Buttons → Docs and play around with the various buttons.

Screenshot

image

@keoshi keoshi added [Status] Needs Review To request a review from Crew. Label will be renamed soon. [Status] Needs Design Review Design has been added. Needs a review! RNA [JS Package] Storybook labels Oct 21, 2021
@keoshi keoshi requested review from a team October 21, 2021 16:26
@keoshi keoshi self-assigned this Oct 21, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello keoshi! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D68843-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 21, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: March 1, 2022.
  • Scheduled code freeze: February 22, 2022.

Backup plugin:

  • Next scheduled release: March 1, 2022.
  • Scheduled code freeze: February 21, 2022.

@madebynoam
Copy link

Just a little comment above, otherwise LGTM! Great job @keoshi!

@sergeymitr
Copy link
Contributor

Wow, this is awesome, thanks for doing this!
I've got to run now, but can't wait to review it when I get back!

madebynoam
madebynoam previously approved these changes Oct 21, 2021
Copy link
Contributor

@fgiannar fgiannar left a comment

Choose a reason for hiding this comment

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

Wonderful work, Filipe!

I left a few inline comments :)

Out of curiosity, I see you are using the MDX format, I guess because you wish to add custom docs, right? We could take it one step further maybe by utlizing Templates and Controls that will allow us, eg, to edit a button's label but I think this is totally optional in this case.

projects/js-packages/base-styles/_colors.scss Outdated Show resolved Hide resolved
<Story name="Plain button">
<button type="button" className="components-button is-small">Button</button>
<Story name="Primary button">
<Button variant="primary" href="#">
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could omit href for non-link Buttons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to get us using link Buttons only by not documenting non-link ones. This would make it easier to see the Storybook documentation and grab the right code from there.

Is there a scenario where we currently use a real <button> element instead of a link as a button? But bottom line, you're right. Maybe these should not be enforced as link-buttons.

@keoshi keoshi requested a review from fgiannar November 2, 2021 14:55
@keoshi keoshi added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Nov 2, 2021

&:focus:not(:disabled) {
color: var( --jp-color-red-50 );
}
Copy link
Contributor

@sergeymitr sergeymitr Nov 3, 2021

Choose a reason for hiding this comment

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

Thanks for fixing the issues!
One little thing I just noticed.
The button label becomes unreadable on hover, should we make it white?
Screen Shot 2021-11-03 at 3 44 38 PM

Suggested change
}
}
&:disabled {
color: var( --jp-color-white );
}

@import './variables';
@import './colors';

.components-button {
Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed it with the team today, and discovered that these styles will also apply to non-RNA buttons, and in some cases could affect even non-Jetpack elements on the page.
We're discussing possible solutions in Slack: p1635967176436400-slack-CBG1CP4EN

Comment on lines +90 to +100
a {
color: #000;
text-decoration: underline;
}
}
}

a.jp-connection-screen-icon {
text-decoration: none;
padding-left: 5px;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Reintroducing these lines, were lost in transition when we merged #21521.
They are responsible for styling the "See all Jetpack features" button and the "external" icon:

Screen Shot 2021-11-04 at 10 44 06 AM

@@ -86,8 +86,18 @@
padding-left: 30px;
margin-bottom: 9px;
color: var( --jp-black );

a {
Copy link
Contributor

Choose a reason for hiding this comment

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

@sergeymitr Do we need to repeat the link styles in li? They are also defined in line 60

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we do. I tried without it, and there was no underline.
Apparently some other style overwrites it.
I didn't dig deep into it though ¯\_(ツ)_/¯

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I will look into this more while working on the base styles

@github-actions github-actions bot added [JS Package] IDC [Package] Connection UI This package no longer exists in the monorepo. [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Nov 4, 2021
@fgiannar
Copy link
Contributor

fgiannar commented Nov 5, 2021

Hi @keoshi ,

While testing this I notices that we don't have buttons styles for active button state.

This results in:
Screenshot 2021-11-05 at 12 46 47 PM

Should we add those as well?

@keoshi
Copy link
Contributor Author

keoshi commented Nov 8, 2021

Yeah, we totally should @fgiannar ! I was trying to test those but couldn't get them to work.

@fgiannar
Copy link
Contributor

fgiannar commented Nov 8, 2021

@keoshi I'm thinking to use this PR as the basis for the work needed to properly configure the base styles package.
While working on it I can address the issues we've mentioned so I can take the burden of having to maintain / update the PR yourself.
Just let me know here in a comment the changes you'd wish to add and I'd be happy to incorporate them :)

@keoshi
Copy link
Contributor Author

keoshi commented Nov 11, 2021

Sorry @fgiannar — I missed the latest notification on this PR somehow.

The only thing I believe is missing are the active states. Do you need those to be specified beyond what we currently have in Figma?

Thank you, appreciate you taking this through the finish line!!

@sergeymitr
Copy link
Contributor

Hi @keoshi.
Just a quick update on the state of things.
We're still designing the Base-Styles package, considering different approaches to make it easy to use and prevent it from disrupting other styles on the page.
Here's the discussion we're having: p9dueE-3Tq-p2

@samiff
Copy link
Contributor

samiff commented Dec 10, 2021

@sergeymitr Is the base-styles package still being discussed, or has it reached a more stable status?

@kraftbj
Copy link
Contributor

kraftbj commented Feb 8, 2022

Howdy y'all — what is the status of this one? I'm going to mark it as "needs author reply" to clean up the "Needs Review" board since there are multiple conflicts and needs a master-merge.

@kraftbj kraftbj added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Feb 8, 2022
@renatoagds
Copy link
Contributor

Closing in favor of #23584

@renatoagds renatoagds closed this Mar 23, 2022
@github-actions github-actions bot removed [Status] Needs Design Review Design has been added. Needs a review! [Status] Design Input Requested [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[JS Package] Base Styles [JS Package] Components [JS Package] Connection [JS Package] IDC [JS Package] Storybook [Package] Connection UI This package no longer exists in the monorepo. [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ RNA Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants