Path: blob/main/components/dashboard/src/prebuilds/configuration-input/ComboboxSelectedItem.tsx
2501 views
/**1* Copyright (c) 2024 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { FC, ReactNode } from "react";7import { cn } from "@podkit/lib/cn";89type Props = {10// Either a string of the icon source or an element11icon?: ReactNode;12loading?: boolean;13title: ReactNode;14subtitle?: ReactNode;15htmlTitle?: string;16titleClassName?: string;17};18export const ComboboxSelectedItem: FC<Props> = ({19icon,20loading = false,21title,22subtitle,23htmlTitle,24titleClassName,25}) => {26return (27<div28className={cn("flex items-center truncate", loading && "animate-pulse")}29title={htmlTitle}30aria-live="polite"31aria-busy={loading}32>33<div className="flex-col ml-1 flex-grow truncate">34{loading ? (35<div className="flex-col space-y-2">36<div className="bg-pk-content-tertiary/25 h-4 w-24 rounded" />37<div className="bg-pk-content-tertiary/25 h-2 w-40 rounded" />38</div>39) : (40<>41<div className={cn("text-pk-content-secondary font-semibold", titleClassName)}>{title}</div>42<div className="text-xs text-pk-content-tertiary truncate">{subtitle}</div>43</>44)}45</div>46</div>47);48};495051