File size: 1,643 Bytes
c867d8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import type { FC } from 'react'
import React from 'react'
import { RiRefreshLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import type { Theme } from './theme/theme-context'
import { CssTransform } from './theme/utils'
import Tooltip from '@/app/components/base/tooltip'

export type IHeaderProps = {
  isMobile?: boolean
  customerIcon?: React.ReactNode
  title: string
  theme?: Theme
  onCreateNewChat?: () => void
}
const Header: FC<IHeaderProps> = ({

  isMobile,

  customerIcon,

  title,

  theme,

  onCreateNewChat,

}) => {
  const { t } = useTranslation()
  if (!isMobile)
    return null

  return (
    <div

      className={`

        shrink-0 flex items-center justify-between h-14 px-4 

      `}

      style={Object.assign({}, CssTransform(theme?.backgroundHeaderColorStyle ?? ''), CssTransform(theme?.headerBorderBottomStyle ?? '')) }

    >

      <div className="flex items-center space-x-2">

        {customerIcon}

        <div

          className={'text-sm font-bold text-white'}

          style={CssTransform(theme?.colorFontOnHeaderStyle ?? '')}

        >

          {title}

        </div>

      </div>

      <Tooltip

        popupContent={t('share.chat.resetChat')}

      >

        <div className='flex cursor-pointer hover:rounded-lg hover:bg-black/5 w-8 h-8 items-center justify-center' onClick={() => {

          onCreateNewChat?.()

        }}>

          <RiRefreshLine className="h-4 w-4 text-sm font-bold text-white" color={theme?.colorPathOnHeader}/>

        </div>

      </Tooltip>

    </div>
  )
}

export default React.memo(Header)