Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Synced from upstream: 8853637e981ed7d8a6cff32bd98e7afe20f54362
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 const ModuleLayoutIcon: React.FC<ILayoutIcon> = (props) => {
|
|
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)} />
|
|
)}
|
|
</>
|
|
);
|
|
};
|