diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2024-12-03 00:02:21 -0500 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2024-12-03 00:02:21 -0500 |
commit | 8ad470aaf5434005db4c59106dcbcf4cbc8cf49b (patch) | |
tree | e7df44904ce00bed8d7d45e8d1c22e7253eed6b1 /extension/src/components/Body.tsx | |
parent | afa44751b7f9d39c4842d5a91a9e3ce28d74bfce (diff) | |
download | bookmarks-home-8ad470aaf5434005db4c59106dcbcf4cbc8cf49b.tar.gz bookmarks-home-8ad470aaf5434005db4c59106dcbcf4cbc8cf49b.tar.bz2 bookmarks-home-8ad470aaf5434005db4c59106dcbcf4cbc8cf49b.zip |
Push drag and drop code so far
Diffstat (limited to 'extension/src/components/Body.tsx')
-rw-r--r-- | extension/src/components/Body.tsx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/extension/src/components/Body.tsx b/extension/src/components/Body.tsx index e575d89..07b0259 100644 --- a/extension/src/components/Body.tsx +++ b/extension/src/components/Body.tsx @@ -9,9 +9,15 @@ import {getBrowser} from "../main.tsx"; export const Settings = React.createContext<[ISettings, (arg0: ISettings) => void]>([ - defaultSettings, - () => {} -]); + defaultSettings, + () => {} + ]); + +export const ActiveDrag = + React.createContext<[boolean, (arg0: boolean) => void]>([ + false, + () => {} + ]) /** * A component for the full body of the application @@ -22,6 +28,7 @@ function Body() { const [settings, setSettings] = useState<ISettings>(defaultSettings); const [selectedBookmarkTree, setSelectedBookmarkTree] = useState<BookmarkTreeNode[]>([]) const [fullBookmarkTree, setFullBookmarkTree] = useState<BookmarkTreeNode[] | null>([]) + const [activeDrag, setActiveDrag] = useState(false); useEffect(() => { loadSettings().then(r => { @@ -47,6 +54,7 @@ function Body() { return ( <Settings.Provider value={[settings!, setSettings]}> + <ActiveDrag.Provider value={[activeDrag, setActiveDrag]}> {(() => {switch (settings.backgroundMode) { case "color": return (<style>{"body {background-color: " + settings.backgroundColor + "; }"}</style>) case "image": return (<style>{"body {background-image: url(\"" + settings.backgroundImage + "\"); }"}</style>) @@ -63,6 +71,7 @@ function Body() { </div> <SettingsEditor tree={fullBookmarkTree!} isOpen={[settingsOpen, setSettingsOpen]}/> {selectedBookmarkTree[0] && (<FolderBody data={selectedBookmarkTree[0]}/>)} + </ActiveDrag.Provider> </Settings.Provider> ) } |