-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate DropdownMenu component
- Loading branch information
1 parent
13ef062
commit 56d15bb
Showing
15 changed files
with
94 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,13 @@ | ||
import React from 'react' | ||
import { MenuItem, MenuItemProps } from 'reakit' | ||
import * as Ariakit from '@ariakit/react' | ||
import { CreateWuiProps, forwardRef } from '@welcome-ui/system' | ||
|
||
import * as S from './Item.styled' | ||
|
||
import { DropdownMenuOptions } from '.' | ||
export type ItemProps = CreateWuiProps<'button', Ariakit.MenuItemProps> | ||
|
||
type ItemOptions = Pick<DropdownMenuOptions, 'state'> & | ||
Partial<Omit<MenuItemProps, keyof DropdownMenuOptions['state']>> | ||
|
||
export type ItemProps = CreateWuiProps<'button', ItemOptions> | ||
|
||
export const Item = forwardRef<'button', ItemProps>(({ as, children, state, ...rest }, ref) => { | ||
return ( | ||
<MenuItem as={undefined} type="button" {...state} {...rest} ref={ref}> | ||
{menuItemProps => { | ||
return ( | ||
<S.Item as={as} {...menuItemProps}> | ||
{children} | ||
</S.Item> | ||
) | ||
}} | ||
</MenuItem> | ||
) | ||
export const Item = forwardRef<'button', ItemProps>(({ as, ...rest }, ref) => { | ||
return <Ariakit.MenuItem ref={ref} type="button" {...rest} render={<S.Item as={as} />} /> | ||
}) | ||
|
||
Item.displayName = 'Item' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
import React from 'react' | ||
import { MenuSeparator, MenuSeparatorProps } from 'reakit' | ||
import * as Ariakit from '@ariakit/react' | ||
import { CreateWuiProps, forwardRef } from '@welcome-ui/system' | ||
|
||
import * as S from './Separator.styled' | ||
|
||
import { DropdownMenuOptions } from '.' | ||
export type SeparatorProps = CreateWuiProps<'div', Ariakit.MenuSeparatorProps> | ||
|
||
export type SeparatorProps = CreateWuiProps< | ||
'div', | ||
MenuSeparatorProps & { state: DropdownMenuOptions['state'] } | ||
> | ||
|
||
export const Separator = forwardRef<'div', SeparatorProps>(({ state, ...rest }, ref) => { | ||
return <MenuSeparator as={S.Separator} ref={ref} {...state} {...rest} /> | ||
export const Separator = forwardRef<'div', SeparatorProps>((props, ref) => { | ||
return <Ariakit.MenuSeparator as={S.Separator} ref={ref} {...props} /> | ||
}) |
Oops, something went wrong.