koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
30 lines (29 loc) • 620 B
JavaScript
"use client";
import { useCallback as o } from "react";
import { useDrawerContext as s } from "./DrawerContext.js";
import { Actions as r } from "./DrawerReducer.js";
const u = (e) => {
const { state: t } = s();
return e(t);
}, i = (e) => {
const { dispatch: t } = s(), n = o(() => {
t({
type: r.DRAWER_OPEN,
id: e
});
}, [e, t]), c = o(() => {
t({
type: r.DRAWER_CLOSE,
id: e
});
}, [e, t]), p = u((a) => a.open);
return {
openDrawer: n,
closeDrawer: c,
isOpen: e === p
};
};
export {
i as useDrawerState
};
//# sourceMappingURL=useDrawerState.js.map