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

Dark mode select combobox menu checkbox #1878

Merged
merged 9 commits into from
Feb 26, 2024

Conversation

rossedfort
Copy link
Contributor

@rossedfort rossedfort commented Feb 23, 2024

Description & motivation 💭

  • Update dark mode styles for Menu (Menu Button and Menu Item), Select, Combobox, and Checkbox
  • Remove "theme" props for these components, they will respect whatever mode the UI is using
  • Checkbox is tricky cause it can display on a dark background (i.e. a table header) in light mode. May need to revisit later.
  • Also clean up Button styles a little by making re-usable shadow classes.

Screenshots (if applicable) 📸

checkbox

light mode dark mode
Screenshot 2024-02-23 at 10 50 55 AM Screenshot 2024-02-23 at 10 50 45 AM

menu

light mode dark mode
primary Screenshot 2024-02-23 at 10 48 15 AM Screenshot 2024-02-23 at 10 48 10 AM
secondary Screenshot 2024-02-23 at 10 48 23 AM Screenshot 2024-02-23 at 10 48 26 AM
ghost Screenshot 2024-02-23 at 10 48 33 AM Screenshot 2024-02-23 at 10 48 37 AM
menu items Screenshot 2024-02-23 at 11 01 10 AM Screenshot 2024-02-23 at 10 49 33 AM

combobox

light mode dark mode
Screenshot 2024-02-23 at 10 52 25 AM Screenshot 2024-02-23 at 10 52 18 AM

select

light mode dark mode
Screenshot 2024-02-23 at 10 54 21 AM Screenshot 2024-02-23 at 10 54 16 AM

Note minor checkbox change in table header

before after
Screenshot 2024-02-23 at 11 03 50 AM Screenshot 2024-02-23 at 11 04 03 AM

Design Considerations 🎨

Testing 🧪

How was this tested 👻

  • Manual testing
  • E2E tests added
  • Unit tests added

Steps for others to test: 🚶🏽‍♂️🚶🏽‍♀️

Checklists

Draft Checklist

Merge Checklist

Issue(s) closed

Docs

Any docs updates needed?

@rossedfort rossedfort requested a review from a team as a code owner February 23, 2024 18:06
@rossedfort rossedfort requested review from KATIETOLER and removed request for a team February 23, 2024 18:06
Copy link

vercel bot commented Feb 23, 2024

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

Name Status Preview Comments Updated (UTC)
holocene ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2024 5:02pm

@rossedfort rossedfort requested review from stevekinney, Alex-Tideman and GraceGardner and removed request for KATIETOLER February 23, 2024 18:06
Comment on lines 114 to +126
slate: {
50: '#F5F7F9',
100: '#E7EDF2',
200: '#D5DEE8',
300: '#B9C9D7',
400: '#97AEC3',
500: '#7E95B3',
600: '#667CA1',
700: '#607195',
800: '#525D7B',
900: '#444F64',
950: '#2D323E',
DEFAULT: '#7E95B3',
50: '#E8EFFF',
100: '#C9D9F0',
200: '#AEBED9',
300: '#92A4C3',
400: '#7C8FB1',
500: '#667CA1',
600: '#576E8F',
700: '#465A78',
800: '#273860',
900: '#1E293B',
950: '#0F172A',
DEFAULT: '#667CA1',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +146 to +148
export const getColor = (
color: keyof Palette,
shade: Shade = 'DEFAULT',
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 don't think the typing was working properly before, now getColor is strongly typed
Screenshot 2024-02-23 at 11 09 20 AM

@@ -9,4 +11,5 @@ export const rgb = (hexColor: `#${string}`): RGB => {
return `${r} ${g} ${b}`;
};

export const css = (variable: CSSVariable) => `rgb(var(${variable}))`;
export const css = (variable: keyof typeof variables, opacity?: Opacity) =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

made strongly typed

Screenshot 2024-02-23 at 11 09 35 AM

Copy link
Contributor

@GraceGardner GraceGardner left a comment

Choose a reason for hiding this comment

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

This looks way better, everything is really nice and clean. Something to strive for in my PR's. Any chance you can explain to me why we should get rid of the primary, secondary, danger and success colors? Will we just not be using them, or is it bad naming convention?

@rossedfort
Copy link
Contributor Author

rossedfort commented Feb 23, 2024

Any chance you can explain to me why we should get rid of the primary, secondary, danger and success colors? Will we just not be using them, or is it bad naming convention?

Yes the reason has to do with just having consistent naming conventions. That big color object ends up being included in our tailwind theme, so that when we do bg-blue for example, we get our blue, not tailwind's blue. I'm of the opinion that those colors should be named like actual colors, blue, green, red, etc. Then the mapping of those colors to semantic names, i.e. primary, secondary, danger, etc. should happen at one level higher of abstraction, like the variable names and class helpers. So roughly something like:

const colors = {
  indigo: {
    // ...
    600: '#444CE7',
    // ...
  }
}
const variables = {
  '--color-primary': rgb(getColor('indigo', 600)),
}

@rossedfort rossedfort merged commit 63bd7a4 into main Feb 26, 2024
11 checks passed
@rossedfort rossedfort deleted the dark-mode-select-combobox-menu-checkbox branch February 26, 2024 18:02
Alex-Tideman pushed a commit that referenced this pull request Feb 27, 2024
* first pass at new dark mode for...

input, menu, select, and combobox

* clean up some styles

* fix checkbox

* fix snaps, remove commented out style

* fix some button stuff I broke

* fix checkbox

* clean up hover borders on menu button

* fix tests/types

* return empty string label if no selected option and no placeholder
Alex-Tideman added a commit that referenced this pull request Feb 27, 2024
* Upgrade to Svelte4

* migration to SvelteKit 2

* Update @types/node and caniuse-lite

* update sveltekit and vite to fix vulnerabilities

* Expose slot bindings to named slots

* Update snaps and tests

* Fix type imports

* Fix outside-click

* fix some type stuff

* Bump types/node for sec vul

* Update snaps and tests

* Fix snaps?

* Update snaps

* Dark mode select combobox menu checkbox (#1878)

* first pass at new dark mode for...

input, menu, select, and combobox

* clean up some styles

* fix checkbox

* fix snaps, remove commented out style

* fix some button stuff I broke

* fix checkbox

* clean up hover borders on menu button

* fix tests/types

* return empty string label if no selected option and no placeholder

* 2.23.6 (#1882)

Co-authored-by: Temporal Data (cicd) <commander-data@temporal.io>

* Fix snaps

* Actually factually for suresies 100% I know it has to be true and this is the final time and I won't make this mistake again after merging fixed the snaps

---------

Co-authored-by: Alex Tideman <alex.tideman@gmail.com>
Co-authored-by: Ross Edfort <rossedfort@gmail.com>
Co-authored-by: Temporal Data (cicd) <commander-data@temporal.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants