An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
feat: Update SearchArtifactContent and Section components for improved layout and badge support
Yoshiki Miura35b3d6aa6e2a
diff --git a/components/artifact/search-artifact-content.tsx b/components/artifact/search-artifact-content.tsxindex cea8d31c..8f939cf4 100644--- a/components/artifact/search-artifact-content.tsx+++ b/components/artifact/search-artifact-content.tsx@@ -16,7 +16,7 @@ export function SearchArtifactContent({ tool }: { tool: ToolInvocation }) {}return (- <div className="p-4 space-y-2">+ <div className="space-y-2">{searchResults.images && searchResults.images.length > 0 && (<SearchResultsImageSectionimages={searchResults.images}diff --git a/components/section.tsx b/components/section.tsxindex 7fd7e80b..dd4e34d3 100644--- a/components/section.tsx+++ b/components/section.tsx@@ -13,6 +13,7 @@ import {} from 'lucide-react'import React from 'react'import { ToolBadge } from './tool-badge'+import { Badge } from './ui/badge'import { Separator } from './ui/separator'import { StatusIndicator } from './ui/status-indicator'@@ -34,6 +35,7 @@ export const Section: React.FC<SectionProps> = ({const iconSize = 16const iconClassName = 'mr-1.5 text-muted-foreground'let icon: React.ReactNode+ let type: 'text' | 'badge' = 'text'switch (title) {case 'Images':// eslint-disable-next-line jsx-a11y/alt-text@@ -44,6 +46,7 @@ export const Section: React.FC<SectionProps> = ({breakcase 'Sources':icon = <Newspaper size={iconSize} className={iconClassName} />+ type = 'badge'breakcase 'Answer':icon = <BookCheck size={iconSize} className={iconClassName} />@@ -67,12 +70,18 @@ export const Section: React.FC<SectionProps> = ({className)}>- {title && (+ {title && type === 'text' && (<h2 className="flex items-center leading-none py-2">{icon}{title}</h2>)}+ {title && type === 'badge' && (+ <Badge variant="secondary">+ {icon}+ {title}+ </Badge>+ )}{children}</section></>