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

Component/language drop down #5982

Merged
merged 4 commits into from
Oct 17, 2023

Conversation

Rounak-stha
Copy link
Contributor

Description

This PR creates LanguageDropDown component. The figma design is followed and the component is tested visually.
This PR also removes the leftover files from the previus design as mentioned in the issue.

Validation

Dark Mode:

image

Light Mode:

image

Related Issues

Addresses #5981

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npx turbo lint to ensure the code follows the style guide. And run npx turbo lint:fix to fix the style errors if necessary.
  • I have run npx turbo format to ensure the code follows the style guide.
  • I have run npx turbo test to check if all tests are passing.
  • I've covered new added functionality with unit tests if necessary.

@Rounak-stha Rounak-stha requested a review from a team as a code owner October 11, 2023 18:25
@vercel
Copy link

vercel bot commented Oct 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 16, 2023 0:12am

@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2023

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 96%
95% (285/300) 76.81% (53/69) 93.33% (56/60)

Unit Test Report

Tests Skipped Failures Errors Time
29 0 💤 0 ❌ 0 🔥 6.857s ⏱️

@ovflowd
Copy link
Member

ovflowd commented Oct 11, 2023

image

Does the Radix component support a scroll/max amount of items to render / maxheight?

@Rounak-stha
Copy link
Contributor Author

Rounak-stha commented Oct 12, 2023

Does the Radix component support a scroll/max amount of items to render / maxheight?

Yes, it does. I've set the max-height and here's what it looks like.

In Firefox

image
image

In Chrome

image
I'm finding a way to change webkit colors in dark mode for webkit.

Radix also ships a Scroll-area component if want to use that.

NOTE: The scrollbar width will be included in the width of the container.

@ovflowd
Copy link
Member

ovflowd commented Oct 12, 2023

I'm finding a way to change webkit colors in dark mode for webkit.

I think that is done with color-scheme. Not sure if Storybook is respecting that yet; But we also haven't configured it yet I supposed (on our base-styles) (We might want to add color-scheme: dark for when the [data-theme="dark"] global style being applied.

@Rounak-stha
Copy link
Contributor Author

I think that is done with color-scheme. Not sure if Storybook is respecting that yet; But we also haven't configured it yet I supposed (on our base-styles) (We might want to add color-scheme: dark for when the [data-theme="dark"] global style being applied.

I am trying this but it's not working. The media query for preferred-color-scheme: dark always fires as it's the default setting in my machine even when settng the color-scheme.

@ovflowd
Copy link
Member

ovflowd commented Oct 12, 2023

I think that is done with color-scheme. Not sure if Storybook is respecting that yet; But we also haven't configured it yet I supposed (on our base-styles) (We might want to add color-scheme: dark for when the [data-theme="dark"] global style being applied.

I am trying this but it's not working. The media query for preferred-color-scheme: dark always fires as it's the default setting in my machine even when settng the color-scheme.

Don't worry about that. That is a Storybook-specific issue. That happens because Storybook itself, sets itself (its own theme) to what matches your system, so it actually overrides whatever we set as color-scheme.

We might be able to disable that on Storybook and I can investigate that, but for now. Don't worry about it not working on your Storybook. You can check the behaviour, if you inspect the iframe HTML element and remove the "color-scheme" that Storybook injects.

@Rounak-stha
Copy link
Contributor Author

I am using the theme() function to use tailwind colors but it results in error when linting (npx turbo lint) and formatting (npx turbo format) .
Any suggestions?

@ovflowd
Copy link
Member

ovflowd commented Oct 13, 2023

I am using the theme() function to use tailwind colors but it results in error when linting (npx turbo lint) and formatting (npx turbo format) . Any suggestions?

Can you show how are you using it?

@Rounak-stha
Copy link
Contributor Author

Can you show how are you using it?

Using color-scheme did not work for me even outside storybook.
Instead, I did this.

[data-theme='dark'] .dropDownContent {
  --language-drop-scrollbar-bg: theme('colors.neutral.900');
  --language-drop-scrollthumb-bg: theme('colors.neutral.800');
}

[data-theme='dark'] .scrollbar {
  scrollbar-color: var(--language-drop-scrollthumb-bg)
  var(--language-drop-scrollbar-bg);
}

@ovflowd
Copy link
Member

ovflowd commented Oct 13, 2023

Can you show how are you using it?

Using color-scheme did not work for me even outside storybook. Instead, I did this.

[data-theme='dark'] .dropDownContent {
  --language-drop-scrollbar-bg: theme('colors.neutral.900');
  --language-drop-scrollthumb-bg: theme('colors.neutral.800');
}

[data-theme='dark'] .scrollbar {
  scrollbar-color: var(--language-drop-scrollthumb-bg)
  var(--language-drop-scrollbar-bg);
}

Why are you trying to manually style the scrollbar?

@Rounak-stha
Copy link
Contributor Author

Why are you trying to manually style the scrollbar?

because the default is ugly
image

@ovflowd
Copy link
Member

ovflowd commented Oct 13, 2023

Why are you trying to manually style the scrollbar?

because the default is ugly image

It changes browser by browser OS by OS. It's not part of our styling to style the scroll wheel.

@ovflowd
Copy link
Member

ovflowd commented Oct 15, 2023

@Rounak-stha can you rebase your PR? 👀

- Proper Component Name
- Use Predefined Tailwind Class
- Pass Handler as Prop
@Rounak-stha
Copy link
Contributor Author

Rounak-stha commented Oct 15, 2023

@Rounak-stha can you rebase your PR? 👀

Hey, just did the rebase. 🤞

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

Everything else besides of those two minor things look ok :)

@bmuenzenmeyer
Copy link
Collaborator

@ovflowd what do you think of wrapping the button in https://www.radix-ui.com/primitives/docs/utilities/accessible-icon ? I noticed this utility just now when creating the ThemeToggle component story

@ovflowd
Copy link
Member

ovflowd commented Oct 16, 2023

@ovflowd what do you think of wrapping the button in radix-ui.com/primitives/docs/utilities/accessible-icon ? I noticed this utility just now when creating the ThemeToggle component story

Shouldn't the Icon be wrapped? Not the button? Or whatÄs the difference?

- Replace Tabs with Spaces
- Use Tailwind Default Class for Dropdown Content
@Rounak-stha
Copy link
Contributor Author

@ovflowd what do you think of wrapping the button in https://www.radix-ui.com/primitives/docs/utilities/accessible-icon ? I noticed this utility just now when creating the ThemeToggle component story

Isn't the dropdown trigger button already accessible?

@ovflowd
Copy link
Member

ovflowd commented Oct 16, 2023

@ovflowd what do you think of wrapping the button in radix-ui.com/primitives/docs/utilities/accessible-icon ? I noticed this utility just now when creating the ThemeToggle component story

Isn't the dropdown trigger button already accessible?

Yeah, I think so... @bmuenzenmeyer?

@bmuenzenmeyer
Copy link
Collaborator

bmuenzenmeyer commented Oct 16, 2023

Keyboard, sure. It mentions screen reader a11y too. I can test if my copy of JAWS still works.

We can consider this non-blocking for this PR and I will look to address globally in another issue.

@bmuenzenmeyer bmuenzenmeyer linked an issue Oct 17, 2023 that may be closed by this pull request
@bmuenzenmeyer bmuenzenmeyer added the github_actions:pull-request Trigger Pull Request Checks label Oct 17, 2023
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Oct 17, 2023
@bmuenzenmeyer bmuenzenmeyer added this pull request to the merge queue Oct 17, 2023
Merged via the queue into nodejs:main with commit c197726 Oct 17, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest This Issue is meant for Hacktoberfest 2023
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create LanguageDropDown component
5 participants