Feat/embedding (#553)

Co-authored-by: Gillian97 <jinling.sunshine@gmail.com>
Co-authored-by: Joel <iamjoel007@gmail.com>
This commit is contained in:
zxhlyh
2023-07-12 17:27:50 +08:00
committed by GitHub
parent 397a92f2ee
commit fec607db81
33 changed files with 2208 additions and 41 deletions

View File

@@ -1,48 +1,42 @@
import type { FC } from 'react'
import React from 'react'
import AppIcon from '@/app/components/base/app-icon'
import {
Bars3Icon,
PencilSquareIcon,
} from '@heroicons/react/24/solid'
export type IHeaderProps = {
title: string
icon: string
icon_background: string
isMobile?: boolean
onShowSideBar?: () => void
onCreateNewChat?: () => void
isEmbedScene?: boolean
}
const Header: FC<IHeaderProps> = ({
title,
isMobile,
icon,
icon_background,
onShowSideBar,
onCreateNewChat,
isEmbedScene = false,
}) => {
return (
<div className="shrink-0 flex items-center justify-between h-12 px-3 bg-gray-100">
{isMobile ? (
<div
className='flex items-center justify-center h-8 w-8 cursor-pointer'
onClick={() => onShowSideBar?.()}
>
<Bars3Icon className="h-4 w-4 text-gray-500" />
return !isMobile
? null
: (
<div
className={`shrink-0 flex items-center justify-between h-12 px-3 bg-gray-100 ${
isEmbedScene ? 'bg-gradient-to-r from-blue-600 to-sky-500' : ''
}`}
>
<div></div>
<div className="flex items-center space-x-2">
<AppIcon size="small" icon={icon} background={icon_background} />
<div
className={`text-sm text-gray-800 font-bold ${
isEmbedScene ? 'text-white' : ''
}`}
>
{title}
</div>
</div>
) : <div></div>}
<div className='flex items-center space-x-2'>
<AppIcon size="small" icon={icon} background={icon_background} />
<div className=" text-sm text-gray-800 font-bold">{title}</div>
<div></div>
</div>
{isMobile ? (
<div className='flex items-center justify-center h-8 w-8 cursor-pointer'
onClick={() => onCreateNewChat?.()}
>
<PencilSquareIcon className="h-4 w-4 text-gray-500" />
</div>) : <div></div>}
</div>
)
)
}
export default React.memo(Header)