Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Add language direction picker to Storybook #346

Merged
merged 4 commits into from Oct 25, 2021

Conversation

sarayourfriend
Copy link
Contributor

@sarayourfriend sarayourfriend commented Oct 20, 2021

Fixes

Fixes #332 by @sarayourfriend

Description

Adds a language direction picker in Storybook to make it easier to test RTL styles.

Note: TailwindCSS RTL still isn't installed in this branch but this PR will introduce it. This PR does not introduce any RTL styles, just the ability to easily change the dir attribute on the storybook iframe and updating the locale properties dir attribute that would be used to programatically detect language direction in the app.

Testing Instructions

Checkout this branch and run npm run storybook. Then navigate to any story (like http://localhost:6006/?path=/story/components-downloadbutton--default) and click on the globe icon in the toolbar for the story. Select RTL and ensure that the dir attribute is set on the storybook iframe and that the component is indeed rendered in reverse.

Again, there are currently no RTL styles being applied so the component will be broken in RTL mode. This is expected.

The DownloadButton has been converted to use tailwindcss-rtl classes so you should be able to test against that.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@sarayourfriend sarayourfriend added 🌟 goal: addition Addition of new feature 🤖 aspect: dx Concerns developers' experience with the codebase labels Oct 20, 2021
@sarayourfriend sarayourfriend requested a review from a team as a code owner October 20, 2021 15:37
@sarayourfriend sarayourfriend self-assigned this Oct 20, 2021
@sarayourfriend sarayourfriend added this to In progress in Openverse PRs via automation Oct 20, 2021
@dhruvkb dhruvkb moved this from In progress to Needs review in Openverse PRs Oct 20, 2021
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

This addition will greatly help us improve RTL styling.
Amazing magic with Storybook hooks, Nuxt, Vue, Composition API, React and whatever else needed to be used here!

@sarayourfriend
Copy link
Contributor Author

I'm not sure but potentially this PR should wait for after the Nuxt Bridge upgrade?

@sarayourfriend
Copy link
Contributor Author

I've rebased this PR onto the lastest main branch which has tailwindcss-rtl installed. You should now be able to test this against the DownloadButton and confirm that it looks good in both LTR and RTL modes 🙂

Copy link
Member

@krysal krysal left a comment

Choose a reason for hiding this comment

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

Works great!

Openverse PRs automation moved this from Needs review to Reviewer approved Oct 25, 2021
@sarayourfriend sarayourfriend merged commit d2b9868 into main Oct 25, 2021
Openverse PRs automation moved this from Reviewer approved to Merged! Oct 25, 2021
@sarayourfriend sarayourfriend deleted the add/rtl-sim-storybook branch October 25, 2021 20:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🌟 goal: addition Addition of new feature
Projects
No open projects
Openverse PRs
  
Merged!
Development

Successfully merging this pull request may close these issues.

Add RTL debugging tool to Storybook
3 participants