Skip to content

Commit

Permalink
fix(dropdown): remove search dropdown and fix dropdown click evetn
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmen committed Dec 10, 2023
1 parent 69c22d5 commit c0cf416
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 85 deletions.
30 changes: 20 additions & 10 deletions src/dropdowns/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {css} from "@emotion/react";
import styled from "@emotion/styled";
import {FC, ReactNode} from "react";
import {FC, MouseEventHandler, ReactNode} from "react";
import {useTheme} from "../../hooks";
import {ThemeProp} from "../../providers";

Expand All @@ -10,17 +10,27 @@ export type DropdownProps = {
items: ReactNode[];
className?: string;
children: ReactNode;
onClick?: MouseEventHandler<HTMLUListElement>
}

export const Dropdown: FC<DropdownProps> = ({open, align = 'right', items, className, children}) => {
const theme = useTheme('normal');
return <Wrap className={className} tabIndex={0}>
{children}
{open && <Down className="react-actors-dropdown-down" align={align} theme={theme}>
{items.map((item, index) => <Item key={index} tabIndex={index} theme={theme}>{item}</Item>)}
</Down>}
</Wrap>;
};
export const Dropdown: FC<DropdownProps> =
({
open,
align = 'right',
items,
onClick = (event) => {event.stopPropagation();},
className,
children
}) => {
const theme = useTheme('normal');
return <Wrap className={className} tabIndex={0}>
{children}
<ul onClick={}></ul>
{open && <Down className="react-actors-dropdown-down" align={align} theme={theme} onClick={onClick}>
{items.map((item, index) => <Item key={index} tabIndex={index} theme={theme}>{item}</Item>)}
</Down>}
</Wrap>;
};

const Wrap = styled.div`
position: relative;
Expand Down
47 changes: 0 additions & 47 deletions src/dropdowns/SearchDropdown/SearchDropdown.stories.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions src/dropdowns/SearchDropdown/SearchDropdown.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/dropdowns/SearchDropdown/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/dropdowns/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './Dropdown';
export * from './SearchDropdown';

0 comments on commit c0cf416

Please sign in to comment.