feishin/src/renderer/components/scroll-area/index.tsx

33 lines
821 B
TypeScript
Raw Normal View History

2022-12-31 16:50:20 -08:00
import { forwardRef, Ref } from 'react';
2022-12-19 15:59:14 -08:00
import type { ScrollAreaProps as MantineScrollAreaProps } from '@mantine/core';
import { ScrollArea as MantineScrollArea } from '@mantine/core';
import styled from 'styled-components';
interface ScrollAreaProps extends MantineScrollAreaProps {
children: React.ReactNode;
}
const StyledScrollArea = styled(MantineScrollArea)`
& .mantine-ScrollArea-thumb {
background: var(--scrollbar-thumb-bg);
border-radius: 0;
}
& .mantine-ScrollArea-scrollbar {
padding: 0;
background: var(--scrollbar-track-bg);
}
`;
2022-12-31 16:50:20 -08:00
export const ScrollArea = forwardRef(({ children, ...props }: ScrollAreaProps, ref: Ref<any>) => {
2022-12-19 15:59:14 -08:00
return (
<StyledScrollArea
2022-12-31 16:50:20 -08:00
ref={ref}
2022-12-31 03:15:11 -08:00
scrollbarSize={12}
2022-12-19 15:59:14 -08:00
{...props}
>
{children}
</StyledScrollArea>
);
2022-12-31 16:50:20 -08:00
});