feat: text generation application support run batch (#529)

This commit is contained in:
Joel
2023-07-07 10:35:05 +08:00
committed by GitHub
parent cde1797cc0
commit 11baff6740
24 changed files with 1017 additions and 180 deletions

View File

@@ -1,15 +1,19 @@
'use client'
import React, { FC } from 'react'
import type { FC } from 'react'
import React from 'react'
import cn from 'classnames'
import s from './style.module.css'
export interface ITabHeaderProps {
items: {
id: string
name: string
extra?: React.ReactNode
}[]
type Item = {
id: string
name: string
isRight?: boolean
extra?: React.ReactNode
}
export type ITabHeaderProps = {
items: Item[]
value: string
onChange: (value: string) => void
}
@@ -17,20 +21,26 @@ export interface ITabHeaderProps {
const TabHeader: FC<ITabHeaderProps> = ({
items,
value,
onChange
onChange,
}) => {
const renderItem = ({ id, name, extra }: Item) => (
<div
key={id}
className={cn(id === value ? `${s.itemActive} text-gray-900` : 'text-gray-500', 'relative flex items-center pb-1.5 leading-6 cursor-pointer')}
onClick={() => onChange(id)}
>
<div className='text-base font-semibold'>{name}</div>
{extra || ''}
</div>
)
return (
<div className='flex space-x-4 border-b border-gray-200 '>
{items.map(({ id, name, extra }) => (
<div
key={id}
className={cn(id === value ? `${s.itemActive} text-gray-900` : 'text-gray-500', 'relative flex items-center pb-1.5 leading-6 cursor-pointer')}
onClick={() => onChange(id)}
>
<div className='text-base font-semibold'>{name}</div>
{extra ? extra : ''}
</div>
))}
<div className='flex justify-between border-b border-gray-200 '>
<div className='flex space-x-4'>
{items.filter(item => !item.isRight).map(renderItem)}
</div>
<div className='flex space-x-4'>
{items.filter(item => item.isRight).map(renderItem)}
</div>
</div>
)
}