|
@@ -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={[
|