import React from "react";
import { create } from "zustand";

interface IBottomToolbarStore {
    toolbar: React.ReactNode;
    set: (item: React.ReactNode) => void;
    clear: () => void;
}

export type BottomToolbarState = IBottomToolbarStore;

const useBottomToolbarStore = create<BottomToolbarState>()((set) => ({
    toolbar: undefined,
    set: (item: React.ReactNode) => set(() => ({ toolbar: item })),
    clear: () =>
        set(() => ({
            toolbar: undefined,
        })),
}));

export { useBottomToolbarStore };
