oooeee
This commit is contained in:
@@ -8,13 +8,25 @@ const BarsContext = createContext<{
|
||||
setRightBarSize: (size: number) => void;
|
||||
centerWidth: Accessor<number>;
|
||||
setCenterWidth: (size: number) => void;
|
||||
leftBarVisible: Accessor<boolean>;
|
||||
setLeftBarVisible: (visible: boolean) => void;
|
||||
rightBarVisible: Accessor<boolean>;
|
||||
setRightBarVisible: (visible: boolean) => void;
|
||||
toggleLeftBar: () => void;
|
||||
toggleRightBar: () => void;
|
||||
}>({
|
||||
leftBarSize: () => 0,
|
||||
setLeftBarSize: () => {},
|
||||
rightBarSize: () => 0,
|
||||
setRightBarSize: () => {},
|
||||
centerWidth: () => 0,
|
||||
setCenterWidth: () => {}
|
||||
setCenterWidth: () => {},
|
||||
leftBarVisible: () => true,
|
||||
setLeftBarVisible: () => {},
|
||||
rightBarVisible: () => true,
|
||||
setRightBarVisible: () => {},
|
||||
toggleLeftBar: () => {},
|
||||
toggleRightBar: () => {}
|
||||
});
|
||||
|
||||
export function useBars() {
|
||||
@@ -26,6 +38,11 @@ export function BarsProvider(props: { children: any }) {
|
||||
const [leftBarSize, setLeftBarSize] = createSignal(0);
|
||||
const [rightBarSize, setRightBarSize] = createSignal(0);
|
||||
const [centerWidth, setCenterWidth] = createSignal(0);
|
||||
const [leftBarVisible, setLeftBarVisible] = createSignal(true);
|
||||
const [rightBarVisible, setRightBarVisible] = createSignal(true);
|
||||
|
||||
const toggleLeftBar = () => setLeftBarVisible(!leftBarVisible());
|
||||
const toggleRightBar = () => setRightBarVisible(!rightBarVisible());
|
||||
|
||||
return (
|
||||
<BarsContext.Provider
|
||||
@@ -35,7 +52,13 @@ export function BarsProvider(props: { children: any }) {
|
||||
rightBarSize,
|
||||
setRightBarSize,
|
||||
centerWidth,
|
||||
setCenterWidth
|
||||
setCenterWidth,
|
||||
leftBarVisible,
|
||||
setLeftBarVisible,
|
||||
rightBarVisible,
|
||||
setRightBarVisible,
|
||||
toggleLeftBar,
|
||||
toggleRightBar
|
||||
}}
|
||||
>
|
||||
{props.children}
|
||||
|
||||
Reference in New Issue
Block a user