/**
 * Copyright (c) 2023-present Plane Software, Inc. and contributors
 * SPDX-License-Identifier: AGPL-3.0-only
 * See the LICENSE file for details.
 */

// plane imports
import { ChevronDownIcon, ChevronUpIcon } from "@plane/propel/icons";

type Props = {
  title: string;
  isPreviewEnabled: boolean;
  handleIsPreviewEnabled: () => void;
};

export function FilterHeader({ title, isPreviewEnabled, handleIsPreviewEnabled }: Props) {
  return (
    <div className="sticky top-0 flex items-center justify-between gap-2 bg-transparent pb-1">
      <div className="flex-grow truncate text-caption-sm-medium text-placeholder">{title}</div>
      <button
        type="button"
        className="nodedc-toolbar-icon-button grid h-7 w-7 flex-shrink-0 place-items-center"
        onClick={handleIsPreviewEnabled}
      >
        {isPreviewEnabled ? <ChevronUpIcon height={14} width={14} /> : <ChevronDownIcon height={14} width={14} />}
      </button>
    </div>
  );
}
