Skip to content

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.

fix: dropdown menu entire right can be pulled down (#2568)

Hyden Liua01a3ef01191
diff --git a/packages/component/src/ui/button/dropdown.tsx b/packages/component/src/ui/button/dropdown.tsx
index 005b7194bf..002a69cb79 100644
--- a/packages/component/src/ui/button/dropdown.tsx
+++ b/packages/component/src/ui/button/dropdown.tsx
@@ -8,14 +8,14 @@ import {
import * as styles from './styles.css';
type DropdownButtonProps = {
- onClickDropDown?: MouseEventHandler<SVGSVGElement>;
+ onClickDropDown?: MouseEventHandler<HTMLElement>;
} & ButtonHTMLAttributes<HTMLButtonElement>;
export const DropdownButton = forwardRef<
HTMLButtonElement,
DropdownButtonProps
>(({ onClickDropDown, children, ...props }, ref) => {
- const handleClickDropDown: MouseEventHandler<SVGSVGElement> = e => {
+ const handleClickDropDown: MouseEventHandler<HTMLElement> = e => {
e.stopPropagation();
onClickDropDown?.(e);
};
@@ -23,12 +23,9 @@ export const DropdownButton = forwardRef<
<button ref={ref} className={styles.dropdownBtn} {...props}>
<span>{children}</span>
<span className={styles.divider} />
- <ArrowDownSmallIcon
- className={styles.icon}
- width={16}
- height={16}
- onClick={handleClickDropDown}
- />
+ <span className={styles.dropdownWrapper} onClick={handleClickDropDown}>
+ <ArrowDownSmallIcon className={styles.icon} width={16} height={16} />
+ </span>
</button>
);
});
diff --git a/packages/component/src/ui/button/styles.css.ts b/packages/component/src/ui/button/styles.css.ts
index d4da59a1ab..32ee4a0ff9 100644
--- a/packages/component/src/ui/button/styles.css.ts
+++ b/packages/component/src/ui/button/styles.css.ts
@@ -5,7 +5,8 @@ export const dropdownBtn = style({
alignItems: 'center',
justifyContent: 'center',
padding: '0 10px',
- gap: '4px',
+ // fix dropdown button click area
+ paddingRight: 0,
color: 'var(--affine-text-primary-color)',
fontWeight: 600,
background: 'var(--affine-button-gray-color)',
@@ -28,6 +29,19 @@ export const divider = style({
width: '0.5px',
height: '16px',
background: 'var(--affine-border-color)',
+ // fix dropdown button click area
+ margin: '0 4px',
+ marginRight: 0,
+});
+
+export const dropdownWrapper = style({
+ width: '100%',
+ height: '100%',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ paddingLeft: '4px',
+ paddingRight: '10px',
});
export const icon = style({