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

DropdownDetails > DetailsProps not exported #455

Open
gvillo opened this issue Aug 25, 2024 · 3 comments
Open

DropdownDetails > DetailsProps not exported #455

gvillo opened this issue Aug 25, 2024 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@gvillo
Copy link

gvillo commented Aug 25, 2024

Hi, I found that DetailsProps (which should be named DropdownDetailsProps I think) are not exported and I can't make the following code work:

<Dropdown.Details {...(props)} />

If I use DropdownProps I get the following error
image

@benjitrosch
Copy link
Collaborator

@gvillo thanks for reporting this, I agree the name should be changed. However, it doesn't necessarily need to be exported, and that isn't the source of your error.

The error message is indicating that the event handler you're passing into the props is typed for a <div> rather than <details>. If you aren't manually typing this yourself, my best guess is you're destructuring props coming from somewhere else like a parent component which is causing the mismatch.

@gvillo
Copy link
Author

gvillo commented Aug 27, 2024

I was using DropdownProps because I wanted to have all the types from Dropdown (plus my types). I've tried to do make it work with Dropdown.Details, and that's the error that I am getting, because Dropdown uses div, and Dropdown.Details uses details, and there is no DropdownDetailsProps exported at all so I can make my own component that extends Dropdown.Details.

If I do what I am doing with Dropdown it works flawless, because I can declare

type CustomDropdownProps = DropdownProps & { variant: string }

const CustomDropdown: FC<CustomDropdownProps> = ({variant, ...props}) => {

const _className = 'blabla' // based variant apply classNames, etc etc

return (<Dropdown {...(props as DropdownProps)} className={_className} />)
}

I really think that this should be possible with Dropdown.Details, like it's possible to do it with just Dropdown.

@benjitrosch
Copy link
Collaborator

benjitrosch commented Aug 28, 2024

Looking now and questionable design choices were made on the <Dropdown>. I'm going to reorganize things a bit to help with your issue.

@benjitrosch benjitrosch added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants