header.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type { FC } from 'react'
  2. import React from 'react'
  3. import AppIcon from '@/app/components/base/app-icon'
  4. import {
  5. Bars3Icon,
  6. PencilSquareIcon,
  7. } from '@heroicons/react/24/solid'
  8. export type IHeaderProps = {
  9. title: string
  10. isMobile?: boolean
  11. onShowSideBar?: () => void
  12. onCreateNewChat?: () => void
  13. }
  14. const Header: FC<IHeaderProps> = ({
  15. title,
  16. isMobile,
  17. onShowSideBar,
  18. onCreateNewChat,
  19. }) => {
  20. return (
  21. <div className="shrink-0 flex items-center justify-between h-12 px-3 bg-gray-100">
  22. {isMobile ? (
  23. <div
  24. className='flex items-center justify-center h-8 w-8 cursor-pointer'
  25. onClick={() => onShowSideBar?.()}
  26. >
  27. <Bars3Icon className="h-4 w-4 text-gray-500" />
  28. </div>
  29. ) : <div></div>}
  30. <div className='flex items-center space-x-2'>
  31. <AppIcon size="small" />
  32. <div className=" text-sm text-gray-800 font-bold">{title}</div>
  33. </div>
  34. {isMobile ? (
  35. <div className='flex items-center justify-center h-8 w-8 cursor-pointer'
  36. onClick={() => onCreateNewChat?.()}
  37. >
  38. <PencilSquareIcon className="h-4 w-4 text-gray-500" />
  39. </div>) : <div></div>}
  40. </div>
  41. )
  42. }
  43. export default React.memo(Header)