45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import * as React from "react";
|
|
|
|
import { EIconSize } from "@plane/constants";
|
|
import { BacklogGroupIcon } from "./backlog-group-icon";
|
|
import { CancelledGroupIcon } from "./cancelled-group-icon";
|
|
import { CompletedGroupIcon } from "./completed-group-icon";
|
|
import type { IStateGroupIcon } from "./helper";
|
|
import { getStateGroupColor, STATE_GROUP_SIZES } from "./helper";
|
|
import { StartedGroupIcon } from "./started-group-icon";
|
|
import { UnstartedGroupIcon } from "./unstarted-group-icon";
|
|
|
|
const iconComponents = {
|
|
backlog: BacklogGroupIcon,
|
|
cancelled: CancelledGroupIcon,
|
|
completed: CompletedGroupIcon,
|
|
started: StartedGroupIcon,
|
|
unstarted: UnstartedGroupIcon,
|
|
};
|
|
|
|
export function StateGroupIcon({
|
|
className = "",
|
|
color,
|
|
stateGroup,
|
|
size = EIconSize.SM,
|
|
percentage,
|
|
}: IStateGroupIcon) {
|
|
const StateIconComponent = iconComponents[stateGroup] || UnstartedGroupIcon;
|
|
|
|
return (
|
|
<StateIconComponent
|
|
height={STATE_GROUP_SIZES[size]}
|
|
width={STATE_GROUP_SIZES[size]}
|
|
color={getStateGroupColor(stateGroup, color)}
|
|
className={`flex-shrink-0 ${className}`}
|
|
percentage={percentage}
|
|
/>
|
|
);
|
|
}
|