outaozhen 4 vuotta sitten
vanhempi
commit
9a2d87985a

+ 5 - 9
src/pages/Business/Attendance/components/ShowTitleMenu.tsx

@@ -1,16 +1,12 @@
 import React, { useState } from 'react'
 
 interface ShowTitleMenuProps {
-  option: string[]
+  options: { label: string; value: string }[]
   onSelect?: (vaule: string) => void
-  selectDefaultValue?: string
+  defaultValue?: string
 }
-const ShowTitleMenu: React.FC<ShowTitleMenuProps> = ({
-  option,
-  onSelect,
-  selectDefaultValue = ''
-}) => {
-  const [activeId, setActiveId] = useState(selectDefaultValue)
+const ShowTitleMenu: React.FC<ShowTitleMenuProps> = ({ options, onSelect, defaultValue = '' }) => {
+  const [activeId, setActiveId] = useState(defaultValue)
   const handleItemClick = (id: string) => {
     setActiveId(id)
     if (onSelect) {
@@ -24,7 +20,7 @@ const ShowTitleMenu: React.FC<ShowTitleMenuProps> = ({
       </div>
       <div className="p-4 bg-white" style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
         <ul className="p-0 m-0 list-none text-primary flex flex-col flex-1">
-          {option.map(item => (
+          {options.map(item => (
             <li
               key={item.value}
               className={[

+ 1 - 1
src/pages/Business/Attendance/index.tsx

@@ -126,7 +126,7 @@ const Attendance: React.FC = () => {
 
   return (
     <div className="h-full w-full flex flex-row">
-      <ShowTitleMenu onSelect={onSelect} option={titleOptions} selectDefaultValue="0" />
+      <ShowTitleMenu onSelect={onSelect} options={titleOptions} defaultValue="0" />
       <div className="w-max-3/4">
         <div className="ml-8 bg-white p-4 shadow-md shadow-hex-3e2c5a relative">
           {state.id === '0' ? (