summaryrefslogtreecommitdiffstats
path: root/packages/excalidraw/components/ScrollableList.tsx
blob: 60ca1ad6c03c5d64160f73d74540dc87bef6ad4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import clsx from "clsx";
import { Children } from "react";

import "./ScrollableList.scss";

interface ScrollableListProps {
  className?: string;
  placeholder: string;
  children: React.ReactNode;
}

export const ScrollableList = ({
  className,
  placeholder,
  children,
}: ScrollableListProps) => {
  const isEmpty = !Children.count(children);

  return (
    <div className={clsx("ScrollableList__wrapper", className)} role="menu">
      {isEmpty ? <div className="empty">{placeholder}</div> : children}
    </div>
  );
};