-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: set only one level to be expanded
- Loading branch information
Showing
5 changed files
with
29 additions
and
23 deletions.
There are no files selected for viewing
9 changes: 1 addition & 8 deletions
9
frontend/src/components/modules/AdvancementLevel/AdvancementLevel.hooks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
import { useState } from 'react'; | ||
import { AdvancementLevelHooks } from './AdvancemetLevel.interface'; | ||
|
||
export const useAdvancementLevel = (): AdvancementLevelHooks => { | ||
const [accordionOpen, setAccordionOpen] = useState(false); | ||
export const useAdvancementLevel = () => { | ||
const [modalOpen, setModalOpen] = useState(false); | ||
|
||
const toggleAccordionOpen = () => setAccordionOpen((prevState) => !prevState); | ||
|
||
const openModal = () => setModalOpen(true); | ||
|
||
const hideModal = () => setModalOpen(false); | ||
|
||
return { | ||
hideModal, | ||
openModal, | ||
toggleAccordionOpen, | ||
modalOpen, | ||
accordionOpen, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
frontend/src/components/modules/BucketDetails/BucketDetails.hooks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { useState } from 'react'; | ||
|
||
export const useBucketDetails = () => { | ||
const [levelOpen, setLevelOpen] = useState<null | number>(null); | ||
|
||
const handleOpen = (level: null | number) => { | ||
setLevelOpen((prev) => (prev === level ? null : level)); | ||
}; | ||
|
||
return { | ||
levelOpen, | ||
handleOpen, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters