mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
29 lines
No EOL
1 KiB
TypeScript
29 lines
No EOL
1 KiB
TypeScript
import { cn, getCodeHostIcon } from "@/lib/utils";
|
|
import { CodeHostType } from "@sourcebot/db";
|
|
import { LibraryBigIcon } from "lucide-react";
|
|
import Image from "next/image";
|
|
import { SearchScope } from "../types";
|
|
|
|
interface SearchScopeIconProps {
|
|
searchScope: SearchScope;
|
|
className?: string;
|
|
}
|
|
|
|
export const SearchScopeIcon = ({ searchScope, className = "h-4 w-4" }: SearchScopeIconProps) => {
|
|
if (searchScope.type === 'reposet') {
|
|
return <LibraryBigIcon className={cn(className, "text-muted-foreground flex-shrink-0")} />;
|
|
} else {
|
|
// Render code host icon for repos
|
|
const codeHostIcon = getCodeHostIcon(searchScope.codeHostType as CodeHostType);
|
|
const size = className.includes('h-3') ? 12 : 16;
|
|
return (
|
|
<Image
|
|
src={codeHostIcon.src}
|
|
alt={`${searchScope.codeHostType} icon`}
|
|
width={size}
|
|
height={size}
|
|
className={cn(className, "flex-shrink-0", codeHostIcon.className)}
|
|
/>
|
|
);
|
|
}
|
|
};
|