mirror of
https://github.com/gosticks/plane.git
synced 2025-10-16 12:45:33 +00:00
* chore: move icons from ui package to propel package * chore: package and tsdown config updated * chore: migrate all icon imports from @plane/ui to @plane/propel/icons * chore: remove icon components from @plane/ui package (migrated to @plane/propel/icons) * chore: code refactoring * chore: migrate remaining icon components from @Plane/ui to @Plane/propel/icons * fix: lint error * chore: code refactor
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { FC } from "react";
|
|
import { ISvgIcons } from "@plane/propel/icons";
|
|
import { TLogoProps } from "@plane/types";
|
|
import { getFileURL, truncateText } from "@plane/utils";
|
|
import { Logo } from "@/components/common/logo";
|
|
|
|
type TSwitcherIconProps = {
|
|
logo_props?: TLogoProps;
|
|
logo_url?: string;
|
|
LabelIcon: FC<ISvgIcons>;
|
|
size?: number;
|
|
type?: "lucide" | "material";
|
|
};
|
|
|
|
export const SwitcherIcon: FC<TSwitcherIconProps> = ({
|
|
logo_props,
|
|
logo_url,
|
|
LabelIcon,
|
|
size = 12,
|
|
type = "lucide",
|
|
}) => {
|
|
if (logo_props?.in_use) {
|
|
return <Logo logo={logo_props} size={size} type={type} />;
|
|
}
|
|
|
|
if (logo_url) {
|
|
return (
|
|
<img
|
|
src={getFileURL(logo_url)}
|
|
alt="logo"
|
|
className="rounded-sm object-cover"
|
|
style={{ height: size, width: size }}
|
|
/>
|
|
);
|
|
}
|
|
return <LabelIcon height={size} width={size} />;
|
|
};
|
|
|
|
type TSwitcherLabelProps = {
|
|
logo_props?: TLogoProps;
|
|
logo_url?: string;
|
|
name?: string;
|
|
LabelIcon: FC<ISvgIcons>;
|
|
type?: "lucide" | "material";
|
|
};
|
|
|
|
export const SwitcherLabel: FC<TSwitcherLabelProps> = (props) => {
|
|
const { logo_props, name, LabelIcon, logo_url, type = "lucide" } = props;
|
|
return (
|
|
<div className="flex items-center gap-1 text-custom-text-200">
|
|
<SwitcherIcon logo_props={logo_props} logo_url={logo_url} LabelIcon={LabelIcon} type={type} />
|
|
{truncateText(name ?? "", 40)}
|
|
</div>
|
|
);
|
|
};
|