import { View } from '@tarojs/components';
import { NoticeBar } from 'antd-mobile';
import Taro from '@tarojs/taro';

import logoSrc from '/assets/icons/logo.png';

import styles from './index.module.less';

export default function Header({
  noticeTitle
}) {

  return (
    <View className={styles.header}>
      <View className={styles.left}>
        <img src={logoSrc} className={styles.logo} alt='logo' />
        <View className={styles.title}>
          融易诚
        </View>
      </View>
      {noticeTitle && (
        <NoticeBar
          content={noticeTitle}
          color='alert'
          style={{ width: 206, height: 32, padding: '0 8px', color: 'red', background: '#f5f5f5' }}
          shape='rounded'
          bordered={false}
          onClick={() => Taro.navigateTo({ url: '/pages/notice/index' })}
        />
      )}
    </View>
  );
}
