diff options
author | Sebastian <sebasjm@gmail.com> | 2023-11-20 12:38:16 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-11-20 12:38:16 -0300 |
commit | 6138846050563e0dca95b0b6d792776925e4c35f (patch) | |
tree | b33cd36acf4b38d3a016506d4f7fa681c83beb63 /packages/web-util | |
parent | 7ed3e78f790837479fc2bb2eb6ddc40c78ce59b5 (diff) |
new forms api
Diffstat (limited to 'packages/web-util')
-rw-r--r-- | packages/web-util/src/forms/DefaultForm.tsx | 1 | ||||
-rw-r--r-- | packages/web-util/src/stories.tsx | 26 |
2 files changed, 13 insertions, 14 deletions
diff --git a/packages/web-util/src/forms/DefaultForm.tsx b/packages/web-util/src/forms/DefaultForm.tsx index 92c379459..12babf39a 100644 --- a/packages/web-util/src/forms/DefaultForm.tsx +++ b/packages/web-util/src/forms/DefaultForm.tsx @@ -9,7 +9,6 @@ export interface FlexibleForm<T extends object> { design: DoubleColumnForm; behavior: (form: Partial<T>) => FormState<T>; } - export function DefaultForm<T extends object>({ initial, onUpdate, diff --git a/packages/web-util/src/stories.tsx b/packages/web-util/src/stories.tsx index 4edbf83b5..d9c2406eb 100644 --- a/packages/web-util/src/stories.tsx +++ b/packages/web-util/src/stories.tsx @@ -184,8 +184,8 @@ function ExampleList({ backgroundColor: isSelected ? "green" : i % 2 - ? "lightgray" - : "lightblue", + ? "lightgray" + : "lightblue", marginLeft: "1em", padding: 4, cursor: "pointer", @@ -395,10 +395,10 @@ function folder(groupName: string, value: ComponentOrFolder): ComponentItem[] { try { title = typeof value === "object" && - typeof value.default === "object" && - value.default !== undefined && - "title" in value.default && - typeof value.default.title === "string" + typeof value.default === "object" && + value.default !== undefined && + "title" in value.default && + typeof value.default.title === "string" ? value.default.title : undefined; } catch (e) { @@ -430,12 +430,12 @@ function Application({ examplesInGroups, getWrapperForGroup, }: Props): VNode { + const url = new URL(window.location.href); const initialSelection = getSelectionFromLocationHash( - location.hash, + url.hash, examplesInGroups, ); - const url = new URL(window.location.href); const currentLang = url.searchParams.get("lang") || "en"; if (!langs["en"]) { @@ -448,15 +448,15 @@ function Application({ ); const [sidebarWidth, setSidebarWidth] = useState(200); useEffect(() => { - if (location.hash) { - const hash = location.hash.substring(1); + if (url.hash) { + const hash = url.hash.substring(1); const found = document.getElementById(hash); if (found) { setTimeout(() => { found.scrollIntoView({ block: "center", }); - }, 10); + }, 50); } } }, []); @@ -500,11 +500,11 @@ function Application({ ))} <hr /> </SideBar> - <ResizeHandle + {/* <ResizeHandle onUpdate={(x) => { setSidebarWidth((s) => s + x); }} - /> + /> */} <Content> <ErrorReport selected={selected}> <PreventLinkNavigation> |