mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
close AF-2678, AF-2677, AF-2674, AF-2655 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added customizable spacing for dividers. - Introduced a flexible filter value menu for easier filter editing. - Added options to control visibility of creation actions in empty document views. - **Improvements** - Enhanced menu components for filter values with a more declarative and simplified interface. - Improved vertical alignment in some UI containers. - Updated divider spacing for more consistent UI appearance. - **Bug Fixes** - Menu popups for filters now appear in correct positions. - **Removals** - Removed support for the "zotero" integration type from integration settings and filters. - **Style** - Updated CSS for better menu positioning and alignment. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
|
import clsx from 'clsx';
|
|
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
import { forwardRef } from 'react';
|
|
|
|
import * as styles from './style.css';
|
|
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
export type DividerProps = PropsWithChildren &
|
|
Omit<HTMLAttributes<HTMLDivElement>, 'type'> & {
|
|
orientation?: DividerOrientation;
|
|
size?: 'thinner' | 'default';
|
|
space?: number;
|
|
dividerColor?: string;
|
|
};
|
|
|
|
export const Divider = forwardRef<HTMLDivElement, DividerProps>(
|
|
(
|
|
{
|
|
orientation = 'horizontal',
|
|
size = 'default',
|
|
space: propSpace,
|
|
dividerColor,
|
|
style,
|
|
className,
|
|
...otherProps
|
|
},
|
|
ref
|
|
) => {
|
|
const space = propSpace ?? (orientation === 'horizontal' ? 8 : 2);
|
|
|
|
return (
|
|
<div
|
|
data-divider
|
|
ref={ref}
|
|
className={clsx(
|
|
styles.divider,
|
|
{
|
|
[styles.verticalDivider]: orientation === 'vertical',
|
|
[styles.thinner]: size === 'thinner',
|
|
},
|
|
className
|
|
)}
|
|
style={{
|
|
borderColor: dividerColor ? dividerColor : undefined,
|
|
...style,
|
|
...assignInlineVars({ [styles.dividerSpace]: `${space}px` }),
|
|
}}
|
|
{...otherProps}
|
|
/>
|
|
);
|
|
}
|
|
);
|
|
|
|
Divider.displayName = 'Divider';
|
|
export default Divider;
|