All files / src/components/welcome QuickWinCard.tsx

0% Statements 0/35
0% Branches 0/1
0% Functions 0/1
0% Lines 0/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53                                                                                                         
import React from "react"
import { QuickWinTask } from "./quickWinTasks"
 
interface QuickWinCardProps {
	task: QuickWinTask
	onExecute: () => void
}
 
const renderIcon = (iconName?: string) => {
	if (!iconName) {
		return <span className="codicon codicon-rocket !text-[28px] !leading-[1]"></span>
	}
 
	let iconClass = "codicon-rocket"
	switch (iconName) {
		case "WebAppIcon":
			iconClass = "codicon-dashboard"
			break
		case "TerminalIcon":
			iconClass = "codicon-terminal"
			break
		case "GameIcon":
			iconClass = "codicon-game"
			break
		default:
			break
	}
	return <span className={`codicon ${iconClass} !text-[28px] !leading-[1]`}></span>
}
 
const QuickWinCard: React.FC<QuickWinCardProps> = ({ task, onExecute }) => {
	return (
		<div
			className="flex items-center mb-2 py-0 px-5 space-x-3 rounded-full cursor-pointer group transition-colors duration-150 ease-in-out bg-white/[0.02] border border-[var(--vscode-panel-border)] hover:bg-[var(--vscode-list-hoverBackground)]"
			onClick={() => onExecute()}>
			<div className="flex-shrink-0 flex items-center justify-center w-6 h-6 text-[var(--vscode-icon-foreground)]">
				{renderIcon(task.icon)}
			</div>
 
			<div className="flex-grow min-w-0">
				<h3 className="text-sm font-medium truncate text-[var(--vscode-editor-foreground)] leading-tight mb-0 mt-0 pt-3">
					{task.title}
				</h3>
				<p className="text-xs truncate text-[var(--vscode-descriptionForeground)] leading-tight mt-[1px]">
					{task.description}
				</p>
			</div>
		</div>
	)
}
 
export default QuickWinCard