diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2024-12-31 00:49:03 -0500 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2024-12-31 00:49:03 -0500 |
commit | 41814aa14040aa038c17ee0728532b0e341c5953 (patch) | |
tree | 78ae14228e888a18be5ad685a5277489e8fefc48 /extension/src/components/BMEditor.tsx | |
parent | 7cbba179124ed5a849f9d8c09fc61ec057810e13 (diff) | |
download | bookmarks-home-41814aa14040aa038c17ee0728532b0e341c5953.tar.gz bookmarks-home-41814aa14040aa038c17ee0728532b0e341c5953.tar.bz2 bookmarks-home-41814aa14040aa038c17ee0728532b0e341c5953.zip |
Refactor BMIcon
Diffstat (limited to 'extension/src/components/BMEditor.tsx')
-rw-r--r-- | extension/src/components/BMEditor.tsx | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/extension/src/components/BMEditor.tsx b/extension/src/components/BMEditor.tsx index 2579bdb..4ebdaa2 100644 --- a/extension/src/components/BMEditor.tsx +++ b/extension/src/components/BMEditor.tsx @@ -2,17 +2,25 @@ import React, {useContext, useEffect, useState} from "react"; import CloseIcon from "../assets/close.svg?react" import {ActiveEdit} from "./Body.tsx"; import {getBrowser} from "../main.tsx"; +import RadioButtonGroup from "./RadioButtonGroup.tsx"; function BMEditor() { const [activeEdit, setActiveEdit] = useContext(ActiveEdit); const [iconOptions, setIconOptions] = useState<string[]>([]); + const [gIcon, setGIcon] = useState<string | undefined>(undefined); useEffect(() => { if (!activeEdit) return; + + const gURL = new URL('https://www.google.com/s2/favicons'); + gURL.searchParams.set("sz", "256"); + gURL.searchParams.set("domain_url", activeEdit.url!); + setGIcon(gURL.toString()); + getBrowser().storage.local.get("icon-aval-"+activeEdit.id).then( r => { - setIconOptions(r["icon-aval-"+activeEdit.id]); + setIconOptions(r["icon-aval-" + activeEdit.id]); }); }, [activeEdit]); @@ -39,13 +47,21 @@ function BMEditor() { </>)} <h3>Icon</h3> - {/*<RadioButtonGroup value={undefined}>*/} - {iconOptions && iconOptions.map(s => - // <option value={s}> - <img src={s}/> - // </option> - )} - {/*</RadioButtonGroup>*/} + <h4>Found on the site</h4> + {/*{ iconOptions &&*/} + {/*<RadioButtonGroup value={undefined} children={*/} + {/* iconOptions.map(s => {*/} + {/* return { props: {*/} + {/* value: s,*/} + {/* children: ()*/} + {/* }}*/} + {/* }*/} + {/* )}*/} + {/*/>}*/} + <h4>From Google</h4> + <img src={gIcon}/> + <h4>Custom</h4> + <p>TODO</p> </>)} </div> ); |