Uh oh!
There was an error while loading. Please reload this page.
Migrate Dropdown Component - #5240
Conversation
| @@ -0,0 +1,40 @@ | |||
| import { useState, useEffect } from 'react'; | |||
| export interface ElementPositionAndSize { | |||
There was a problem hiding this comment.
This should go into the types folder
There was a problem hiding this comment.
And probably be a type and not interface
manishprivet
commented
Apr 9, 2023
@harshitphoenix Thanks for the first contribution 🙌🏼 LGTM, just added one comment. Also seems like you will have to run |
ovflowd
left a comment
There was a problem hiding this comment.
Nice stuff! Amazing first contribution! Thank you 🙇
Besides of the few comments I've left, I think we're good to go (after they get addressed)
Uh oh!
There was an error while loading. Please reload this page.
| import Dropdown from '..'; | ||
| describe('Dropdown component', () => { | ||
| const ref = { |
There was a problem hiding this comment.
Is all this extra casting needed here? I feel there are ways we could simplify the casting here 🤔 Maybe we could use the satisfy operator? https://dev.to/ayc0/typescript-49-satisfies-operator-1e4i
| @@ -0,0 +1,30 @@ | |||
| .dropdown-list { | |||
There was a problem hiding this comment.
I think we should use camelCase classnames here
| @@ -0,0 +1,40 @@ | |||
| import { useState, useEffect } from 'react'; | |||
| export interface ElementPositionAndSize { | |||
There was a problem hiding this comment.
And probably be a type and not interface
| elementRef: React.RefObject<T>; | ||
| } | ||
| const Dropdown = <T extends HTMLElement>({ |
There was a problem hiding this comment.
I think on the other components we did not destructure props on component declaration?
| const mappedElements = items.map(item => { | ||
| const extraStyles = { | ||
| fontWeight: (item.active ? 'bold' : 'normal') as 'bold' | 'normal', |
There was a problem hiding this comment.
Is a casting of as bold | normal needed here?
ovflowd
commented
Apr 9, 2023
@manishprivet actually the command for automatically fixing the lint errors is |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
shanpriyan
commented
Apr 9, 2023
Check |
shanpriyan
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the contribution ⭐️
I have left a few comments to fix the lint errors.
Uh oh!
There was an error while loading. Please reload this page.
5cdab56 to
0240b9bCompare6d49fd9 to
6306a22Compare@shanpriyan does this Dropdown component conflict with the one you created? |
shanpriyan
commented
Apr 18, 2023
It's not conflicting I believe |
| @@ -0,0 +1,30 @@ | |||
| .dropdown-list { | |||
There was a problem hiding this comment.
| .dropdown-list { | |
| .dropdownList { |
ovflowd
commented
Apr 18, 2023
But @shanpriyan you made your own Dropdown component. If that gets merged first, what are the benefits of this one? It will be a direct conflict, no? |
shanpriyan
commented
Apr 19, 2023
@ovflowd I'm not sure which DropDown Component you are referring to, As far as I remember I have not worked on any DropDown component 😄 |
ovflowd
commented
Apr 19, 2023
Actually my bad, who did another Dropdown component was @ktssr, so I wonder if we merge that one or this one. I'm not sure what the differences are. @ktssr this PR has a Hook that calculates positioning and stuff, did you not need to add that stuff there? What are your opinions? If the language selector PR gets merged it would probably kill the reason for this PR to exist to begin with 😅 |
ktssr
commented
Apr 19, 2023
@ovflowd, I didn't include the positioning hook in my changes because it seemed unnecessary. However, if you feel it's necessary, you can merge this PR first and I'll make necessary changes accordingly. |
ovflowd
commented
Apr 19, 2023
Hey @ktssr I don't know if it is necessary, and it might not be. I think we can proceed with your implementation, which is simpler and if we feel that something is missing in the future, we can always revisit the Dropdown component with what we saw in this PR. I also feel like the author of this PR kinda abandoned the PR as he didn't reply to any of our comments yet lol |
ovflowd
commented
Apr 20, 2023
Closing as another Dropdown component got merged. |

Migrate Dropdown component from nodejs.dev and created a new story.
Related to: #5193