will be useful going forward, and simplify widget props being passed around all over the placepull/230/head^2
parent
244a76de0b
commit
a677fbefbf
@ -1,10 +1,10 @@
|
||||
import List from "components/bookmarks/list";
|
||||
|
||||
export default function BookmarksGroup({ group, target }) {
|
||||
export default function BookmarksGroup({ group }) {
|
||||
return (
|
||||
<div key={group.name} className="basis-full md:basis-1/2 lg:basis-1/3 xl:basis-1/4 flex-1 p-1">
|
||||
<h2 className="text-theme-800 dark:text-theme-300 text-xl font-medium">{group.name}</h2>
|
||||
<List bookmarks={group.bookmarks} target={target} />
|
||||
<List bookmarks={group.bookmarks} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
import { createContext, useState, useMemo } from "react";
|
||||
|
||||
export const SettingsContext = createContext();
|
||||
|
||||
export function SettingsProvider({ initialSettings, children }) {
|
||||
const [settings, setSettings] = useState({});
|
||||
|
||||
if (initialSettings) {
|
||||
setSettings(initialSettings);
|
||||
}
|
||||
|
||||
const value = useMemo(() => ({ settings, setSettings }), [settings]);
|
||||
|
||||
return <SettingsContext.Provider value={value}>{children}</SettingsContext.Provider>;
|
||||
}
|
Loading…
Reference in new issue