Skip to content

Dropdown component#32

Merged
kohrachel merged 9 commits intomainfrom
dropdown-component
Dec 1, 2025
Merged

Dropdown component#32
kohrachel merged 9 commits intomainfrom
dropdown-component

Conversation

@jhdaws
Copy link
Collaborator

@jhdaws jhdaws commented Oct 31, 2025

add(component): Dropdown

Added dropdown component. Used Css modules, made style folder, don't know if thats what we're going to do moving forward, let me know if I need to change it. I also added svgr to the project to render svgs as react components, hope thats okay. Also added a dropdown-demo page to test the dropdown.

image

@kohrachel
Copy link
Contributor

Sorry I thought I had scaffolded the code better, but we're using styled components for CSS instead of CSS modules (primarily because I figured it would be more straightforward to have everything in one file for people just starting out).

For Icons we're using Google's Material Icons (see Figma for all the icons we're using). I didn't have time to import the icons before this week's tasks but Justin imported them in his PR here. I'll share this link in the Slack as well, but here's Google's docs on how to use their icons.

Copy link
Contributor

@kohrachel kohrachel left a comment

Choose a reason for hiding this comment

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

Thanks for the good + quick work!! 💪🏻 great PR description too :)

The component works well, but there seems to be a lot of complexity here + I noticed that the individual menu items don't get selected when I click on them. How about a simpler approach? React has an example dropdown element on their website here.

svgr.d.ts Outdated
Comment on lines 1 to 5
Copy link
Contributor

Choose a reason for hiding this comment

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

we're going to be using Google's Material Icons, so we won't need this. This is pretty cool though :)

package.json Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

we're using styled components instead of tailwind (the tailwind was from the old code, sorry i thought i'd removed it!)

since the Figma is/should define all styles in CSS, i figured it'd be easier to use styled components.

next.config.ts Outdated
Comment on lines 12 to 28
Copy link
Contributor

Choose a reason for hiding this comment

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

we'll be importing icons directly from Google so we don't need this, but good work :)

Copy link
Contributor

Choose a reason for hiding this comment

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

we probably shouldn't be passing in onClick into the component (my bad) since the Dropdown component should have some standard logic when an item is clicked

Copy link
Contributor

Choose a reason for hiding this comment

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

typical behavior for a dropdown would be to have the first item be the one that is selected by default, i think that would be a better approach than having a selected property on individual menu items.

Comment on lines 64 to 75
Copy link
Contributor

Choose a reason for hiding this comment

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

this feels like it can be simplified.

since the menuItems prop is an array, how about using the array indices to iterate through the array?

Copy link
Contributor

Choose a reason for hiding this comment

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

we should have a state to hold the currently selected item

Comment on lines 81 to 82
Copy link
Contributor

Choose a reason for hiding this comment

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

nice :)

Comment on lines 174 to 177
onClick={() => {
item.onClick?.();
closeMenu();
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

when an item is clicked, we should set it as the selected item (have some state to store this value)

Comment on lines 1 to 33
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice demo! We shouldn't merge demo pages into main but I like it :)

Copy link
Contributor

@kohrachel kohrachel left a comment

Choose a reason for hiding this comment

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

Looks good!

Sorry I didn't manage to separate out the text components from this PR. Just made some small nits:

  • we're using bun.lock, so we don't need package-lock.json
  • text components accept an optional color prop, allowed colors are defined in globals.css
  • I also just realized that Figma uses Material Symbols Rounded instead of Outlined, so I went in and updated that

Great work!! :)

@kohrachel kohrachel merged commit 7f2cfea into main Dec 1, 2025
3 checks passed
@kohrachel kohrachel deleted the dropdown-component branch December 1, 2025 16:28
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.

3 participants

Comments