From da2fba59ddaee800eceee984198da0228fcb5b80 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 21 Apr 2021 16:08:35 +0200 Subject: added search in new game dialog (not finished) --- components/ui.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'components') diff --git a/components/ui.tsx b/components/ui.tsx index 7474240..1e9997a 100644 --- a/components/ui.tsx +++ b/components/ui.tsx @@ -1,4 +1,5 @@ import { ReactNode, useEffect, useState } from 'react'; +import { v4 as uuid } from 'uuid'; import CheckBoxIcon from '@material-ui/icons/CheckBox'; import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; @@ -79,6 +80,7 @@ export function Input(props: { autocomplete?: string; autofocus?: boolean; className?: string; + onChange?: () => void; }) { return ; } -export function SearchBar(props: { label?: string; }) { - return
+export function SearchBar(props: { + label?: string; + search?: (query: string) => void; +}) { + var id = uuid(); + + var getQuery = () => (document.getElementById(id).children[0] as HTMLInputElement).value; + + return
props.search && props.search(getQuery())} /> -
; -- cgit v1.2.3