- 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 <[email protected]>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import * as React from "react";
|
|
import { TimelineLayoutIcon, GridLayoutIcon, ListLayoutIcon } from "@plane/propel/icons";
|
|
import type { TModuleLayoutOptions } from "@plane/types";
|
|
import { cn } from "@plane/utils";
|
|
|
|
interface ILayoutIcon {
|
|
className?: string;
|
|
containerClassName?: string;
|
|
layoutType: TModuleLayoutOptions;
|
|
size?: number;
|
|
withContainer?: boolean;
|
|
}
|
|
|
|
export function ModuleLayoutIcon(props: ILayoutIcon) {
|
|
const { layoutType, className = "", containerClassName = "", size = 14, withContainer = false } = props;
|
|
|
|
// get Layout icon
|
|
const icons = {
|
|
list: ListLayoutIcon,
|
|
board: GridLayoutIcon,
|
|
gantt: TimelineLayoutIcon,
|
|
};
|
|
const Icon = icons[layoutType ?? "list"];
|
|
|
|
if (!Icon) return null;
|
|
|
|
return (
|
|
<>
|
|
{withContainer ? (
|
|
<div className={cn("flex items-center justify-center border rounded p-0.5 flex-shrink-0", containerClassName)}>
|
|
<Icon width={size} height={size} className={cn(className)} />
|
|
</div>
|
|
) : (
|
|
<Icon width={size} height={size} className={cn("flex-shrink-0", className)} />
|
|
)}
|
|
</>
|
|
);
|
|
}
|