// __SDEFILE__ - This file is a dependency for the stand-alone environment import { useState } from 'react' import { DownIcon } from 'shared/components/icons.mjs' import Link from 'next/link' const OpenTitleButton = ({ title, toggle, color = 'primary', openButtons = [], bottom = false, }) => (
{} {!bottom && title}
{openButtons}
) export const Collapse = ({ title, openTitle = false, children = [], buttons = [], top = true, bottom = false, color = 'primary', opened = false, toggle = false, toggleClasses = '', onClick = false, openButtons = null, className = '', }) => { const [open, setOpen] = useState(opened) const TitleBtn = ({ bottom }) => open ? ( setOpen(false)} {...{ color, openButtons, bottom }} /> ) : null return open ? (
{top ? : null}
{children}
{bottom ? : null}
) : (
setOpen(true)} > {title} {toggle ? ( ) : ( buttons )}
) } export const MimicCollapseLink = ({ title, buttons = [], color = 'primary', href = '/', className = '', }) => (
{title}
{buttons} ) export const useCollapseButton = () => { // Shared state const [open, setOpen] = useState(false) // Method to allow closing the button const close = () => setOpen(false) // The component const CollapseButton = ({ title, openTitle = false, children = [], className = 'btn btn-lg btn-primary', top = true, bottom = false, color = 'primary', }) => { const titleBtn = open ? ( setOpen(false)} color={color} /> ) : null return open ? (
{top ? titleBtn : null}
{children}
{bottom ? titleBtn : null}
) : ( ) } return { CollapseButton, closeCollapseButton: close } }