Files
AFFiNE-Mirror/packages/frontend/component/src/ui/divider/divider.tsx
Cats Juice ea92e2291d fix(core): adjust new doc list filter style (#12629)
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 -->
2025-06-23 10:34:00 +00:00

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;