There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: menu item click area (#3051)
Peng Xiaofab03006e81e
diff --git a/packages/component/src/components/app-sidebar/menu-item/index.css.ts b/packages/component/src/components/app-sidebar/menu-item/index.css.tsindex 3b213659b3..6fbf1a2655 100644--- a/packages/component/src/components/app-sidebar/menu-item/index.css.ts+++ b/packages/component/src/components/app-sidebar/menu-item/index.css.ts@@ -44,6 +44,10 @@ export const content = style({flex: 1,});+export const postfix = style({+ justifySelf: 'flex-end',+});+export const icon = style({color: 'var(--affine-icon-color)',fontSize: '20px',diff --git a/packages/component/src/components/app-sidebar/menu-item/index.tsx b/packages/component/src/components/app-sidebar/menu-item/index.tsxindex 7ffe5d8bf8..de63fd5679 100644--- a/packages/component/src/components/app-sidebar/menu-item/index.tsx+++ b/packages/component/src/components/app-sidebar/menu-item/index.tsx@@ -19,6 +19,10 @@ export interface MenuLinkItemPropsextends MenuItemProps,Pick<LinkProps, 'href'> {}+const stopPropagation: React.MouseEventHandler = e => {+ e.stopPropagation();+};+export const MenuItem = React.forwardRef<HTMLDivElement, MenuItemProps>(({@@ -44,6 +48,7 @@ export const MenuItem = React.forwardRef<HTMLDivElement, MenuItemProps>(<divref={ref}{...props}+ onClick={onClick}className={clsx([styles.root, props.className])}data-active={active}data-disabled={disabled}@@ -69,15 +74,16 @@ export const MenuItem = React.forwardRef<HTMLDivElement, MenuItemProps>()}{React.cloneElement(icon, {className: clsx([styles.icon, icon.props.className]),- onClick: onClick,})}</div>)}- <div onClick={onClick} className={styles.content}>- {children}- </div>- {postfix}+ <div className={styles.content}>{children}</div>+ {postfix ? (+ <div className={styles.postfix} onClick={stopPropagation}>+ {postfix}+ </div>+ ) : null}</div>);}