- Add jscodeshift-based codemod to convert arrow function components to function declarations - Support React.FC, observer-wrapped, and forwardRef components - Include comprehensive test suite covering edge cases - Add npm script to run transformer across codebase - Target only .tsx files in source directories, excluding node_modules and declaration files * [WEB-5459] chore: updates after running codemod --------- Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import type { FC } from "react";
|
|
import React from "react";
|
|
import type { ISvgIcons } from "@plane/propel/icons";
|
|
import { DropdownIcon } from "@plane/propel/icons";
|
|
import { cn } from "../utils";
|
|
|
|
type Props = {
|
|
isOpen: boolean;
|
|
title: React.ReactNode;
|
|
hideChevron?: boolean;
|
|
indicatorElement?: React.ReactNode;
|
|
actionItemElement?: React.ReactNode;
|
|
className?: string;
|
|
titleClassName?: string;
|
|
ChevronIcon?: React.FC<ISvgIcons>;
|
|
};
|
|
|
|
export function CollapsibleButton(props: Props) {
|
|
const {
|
|
isOpen,
|
|
title,
|
|
hideChevron = false,
|
|
indicatorElement,
|
|
actionItemElement,
|
|
className = "",
|
|
titleClassName = "",
|
|
ChevronIcon = DropdownIcon,
|
|
} = props;
|
|
return (
|
|
<div
|
|
className={cn(
|
|
"flex items-center justify-between gap-3 h-12 px-2.5 py-3 border-b border-custom-border-200",
|
|
className
|
|
)}
|
|
>
|
|
<div className="flex items-center gap-3.5">
|
|
<div className="flex items-center gap-3">
|
|
{!hideChevron && (
|
|
<ChevronIcon
|
|
className={cn("size-2 text-custom-text-300 hover:text-custom-text-200 duration-300", {
|
|
"-rotate-90": !isOpen,
|
|
})}
|
|
/>
|
|
)}
|
|
<span className={cn("text-base text-custom-text-100 font-medium", titleClassName)}>{title}</span>
|
|
</div>
|
|
{indicatorElement && indicatorElement}
|
|
</div>
|
|
{actionItemElement && isOpen && actionItemElement}
|
|
</div>
|
|
);
|
|
}
|