wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
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
import React, { type FC } from 'react'
import { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'
import type { DatePickerHeaderProps } from '../types'
import { useMonths } from '../hooks'
 
const Header: FC<DatePickerHeaderProps> = ({
  handleOpenYearMonthPicker,
  currentDate,
  onClickNextMonth,
  onClickPrevMonth,
}) => {
  const months = useMonths()
 
  return (
    <div className='mx-2 mt-2 flex items-center'>
      <div className='flex-1'>
        <button
          onClick={handleOpenYearMonthPicker}
          className='system-md-semibold flex items-center gap-x-0.5 rounded-lg px-2 py-1.5 text-text-primary hover:bg-state-base-hover'
        >
          <span>{`${months[currentDate.month()]} ${currentDate.year()}`}</span>
          <RiArrowDownSLine className='h-4 w-4 text-text-tertiary' />
        </button>
      </div>
      <button
        onClick={onClickPrevMonth}
        className='rounded-lg p-1.5 hover:bg-state-base-hover'
      >
        <RiArrowUpSLine className='h-[18px] w-[18px] text-text-secondary' />
      </button>
      <button
        onClick={onClickNextMonth}
        className='rounded-lg p-1.5 hover:bg-state-base-hover'
      >
        <RiArrowDownSLine className='h-[18px] w-[18px] text-text-secondary' />
      </button>
    </div>
  )
}
 
export default React.memo(Header)