summaryrefslogtreecommitdiff
path: root/src-migrate/modules/product-promo/components/CategoryTab.tsx
blob: c8e698c21f09696737042007b509c81e981f00f4 (plain)
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
import React from 'react'
import style from '../styles/category-tab.module.css'
import { useModalStore } from '../stores/useModalStore'
import clsxm from '~/libs/clsxm'
import { ICategoryPromo } from '~/types/promotion'

const TABS: ICategoryPromo[] = [
  { value: 'bundling', label: 'Bundling' },
  { value: 'discount_loading', label: 'Discount Loading' },
  { value: 'merchandise', label: 'Free Merchant' },
]

const ProductPromoCategoryTab = () => {
  const { activeTab, changeTab } = useModalStore()
  return (
    <div className={style.tabs}>
      {TABS.map((tab) => (
        <button
          key={tab.value}
          type='button'
          className={clsxm({
            [style.tab]: true,
            [style.tabActive]: activeTab === tab.value
          })}
          onClick={() => changeTab(tab.value)}
        >
          {tab.label}
        </button>
      ))}
    </div>
  )
}

export default ProductPromoCategoryTab