header.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. icon: string
  11. icon_background: string
  12. isMobile?: boolean
  13. onShowSideBar?: () => void
  14. onCreateNewChat?: () => void
  15. }
  16. const Header: FC<IHeaderProps> = ({
  17. title,
  18. isMobile,
  19. icon,
  20. icon_background,
  21. onShowSideBar,
  22. onCreateNewChat,
  23. }) => {
  24. return (
  25. <div className="shrink-0 flex items-center justify-between h-12 px-3 bg-gray-100">
  26. {isMobile ? (
  27. <div
  28. className='flex items-center justify-center h-8 w-8 cursor-pointer'
  29. onClick={() => onShowSideBar?.()}
  30. >
  31. <Bars3Icon className="h-4 w-4 text-gray-500" />
  32. </div>
  33. ) : <div></div>}
  34. <div className='flex items-center space-x-2'>
  35. <AppIcon size="small" icon={icon} background={icon_background} />
  36. <div className=" text-sm text-gray-800 font-bold">{title}</div>
  37. </div>
  38. {isMobile ? (
  39. <div className='flex items-center justify-center h-8 w-8 cursor-pointer'
  40. onClick={() => onCreateNewChat?.()}
  41. >
  42. <PencilSquareIcon className="h-4 w-4 text-gray-500" />
  43. </div>) : <div></div>}
  44. </div>
  45. )
  46. }
  47. export default React.memo(Header)