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

fix(DropdownMenu.Item): allow usage w/out text #406

Merged
merged 4 commits into from
Dec 20, 2022
Merged

Conversation

ogonkov
Copy link
Contributor

@ogonkov ogonkov commented Dec 6, 2022

No description provided.

@ogonkov ogonkov requested a review from axtk as a code owner December 6, 2022 15:46
@gravity-ui-bot
Copy link
Contributor

Preview is ready.


type Props<T> = DropdownMenuItemType<T> & {
children?: ReactNode;
type Props<T> = Omit<MenuItemProps, 'onClick'> & {
Copy link
Contributor

@axtk axtk Dec 6, 2022

Choose a reason for hiding this comment

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

these changes should be made on the exported props type in ./types

type Props<T> = DropdownMenuItemType<T> & {
children?: ReactNode;
};
type Props<T> = Omit<MenuItemProps, 'onClick'> & Partial<DropdownMenuItemRequiredProps<T>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

if the original DropdownMenuItem type changes in the way it picks props from MenuItemProps or some other way, we'll have to sync it with this type, which is inconvenient, if not a source of errors

why not do exactly what the title of the PR reads:

type Props<T> = Omit<DropdownMenuItem<T>, 'text'> & {
    text?: DropdownMenuItem<T>['text'];
    children?: ReactNode;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is resolves text as required

Copy link
Contributor

Choose a reason for hiding this comment

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

it's strange, tried it out, seems to work
can you show your code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems like i was confused by some WS checks

@ogonkov ogonkov requested a review from axtk December 20, 2022 09:08
@ogonkov ogonkov merged commit 54def67 into main Dec 20, 2022
@ogonkov ogonkov deleted the fix/dropdown/item_types branch December 20, 2022 11:50
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