Skip to content

Commit

Permalink
feat: supported onClickCapture in Item and FooterItem (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunduckcow authored Aug 16, 2023
1 parent 4dff13c commit 4646563
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/CompositeBar/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface ItemProps extends ItemPopup {
collapsed: boolean,
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
) => void;
onItemClickCapture?: (event: React.SyntheticEvent) => void;
}

interface ItemInnerProps extends ItemProps {
Expand Down Expand Up @@ -80,6 +81,7 @@ export const Item: React.FC<ItemInnerProps> = (props) => {
renderPopupContent,
onClosePopup,
onItemClick,
onItemClickCapture,
} = props;

const {compact} = useAsideHeaderContext();
Expand Down Expand Up @@ -131,6 +133,7 @@ export const Item: React.FC<ItemInnerProps> = (props) => {
onItemClick?.(item, false, event);
}
}}
onClickCapture={onItemClickCapture}
onMouseEnter={() => {
if (!compact) {
onMouseEnter?.();
Expand Down
3 changes: 2 additions & 1 deletion src/components/FooterItem/FooterItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import './FooterItem.scss';

const b = block('footer-item');

export interface FooterItemProps extends Omit<ItemProps, 'onItemClick'> {
export interface FooterItemProps extends Omit<ItemProps, 'onItemClick' | 'onItemClickCapture'> {
compact: boolean;
}

Expand All @@ -19,6 +19,7 @@ export const FooterItem: React.FC<FooterItemProps> = ({item, ...props}) => {
item={{iconSize: ASIDE_HEADER_FOOTER_ICON_SIZE, ...item}}
className={b({compact: props.compact})}
onItemClick={item.onItemClick}
onItemClickCapture={item.onItemClickCapture}
/>
);
};
1 change: 1 addition & 0 deletions src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface MenuItem {
collapsed: boolean,
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
) => void;
onItemClickCapture?: (event: React.SyntheticEvent) => void;
itemWrapper?: (
p: MakeItemParams,
makeItem: (p: MakeItemParams) => React.ReactNode,
Expand Down

0 comments on commit 4646563

Please sign in to comment.