import { createContext, RefObject, useRef } from 'react'; import styled from '@emotion/styled'; import { useListenScroll } from '../hooks/useListenScroll'; export const ScrollWrapperContext = createContext>({ current: null, }); const StyledScrollWrapper = styled.div` display: flex; height: 100%; overflow: auto; scrollbar-gutter: stable; width: 100%; &.scrolling::-webkit-scrollbar-thumb { background-color: ${({ theme }) => theme.border.color.medium}; } `; export type ScrollWrapperProps = { children: React.ReactNode; className?: string; }; export const ScrollWrapper = ({ children, className }: ScrollWrapperProps) => { const scrollableRef = useRef(null); useListenScroll({ scrollableRef, }); return ( {children} ); };