feat: add CreateFlowModal #918 (#1343)

### What problem does this PR solve?

feat: add CreateFlowModal #918

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-07-02 16:15:54 +08:00
committed by GitHub
parent 04487d1bce
commit f9adeb9647
11 changed files with 185 additions and 24 deletions

View File

@@ -244,3 +244,28 @@ export const useHandleMessageInputChange = () => {
};
// #endregion
/**
*
* @param defaultId
* used to switch between different items, similar to radio
* @returns
*/
export const useSelectItem = (defaultId?: string) => {
const [selectedId, setSelectedId] = useState('');
const handleItemClick = useCallback(
(id: string) => () => {
setSelectedId(id);
},
[],
);
useEffect(() => {
if (defaultId) {
setSelectedId(defaultId);
}
}, [defaultId]);
return { selectedId, handleItemClick };
};