From d9c0ed96301f51d7d7239b4d6257ef991d7f771c Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Thu, 14 Apr 2022 12:12:49 +0500 Subject: [PATCH] add servant and king explanations --- src/components/EntrySelect.tsx | 42 ++++++++-- src/components/np-picker/NPPicker.tsx | 2 +- src/components/vp-explorer/VPExplorer.tsx | 93 ++++++++++++++++++----- 3 files changed, 109 insertions(+), 28 deletions(-) diff --git a/src/components/EntrySelect.tsx b/src/components/EntrySelect.tsx index 416f999..4b8952b 100644 --- a/src/components/EntrySelect.tsx +++ b/src/components/EntrySelect.tsx @@ -1,12 +1,37 @@ import * as T from "../types"; -import Select from "react-select"; +import { StyleHTMLAttributes } from "react"; +import Select, { StylesConfig } from "react-select"; import AsyncSelect from "react-select/async"; import { makeSelectOption, makeVerbSelectOption, - zIndexProps, } from "./np-picker/picker-tools"; +const customStyles: StylesConfig = { + menuPortal: (base) => ({ + ...base, + zIndex: 99999, + }), + menu: (base) => ({ + ...base, + zIndex: 999999, + }), + option: (provided, state) => ({ + ...provided, + padding: "10px 5px", + }), + input: (base) => ({ + ...base, + padding: 0, + }), + singleValue: (provided, state) => { + const opacity = state.isDisabled ? 0.5 : 1; + const transition = 'opacity 300ms'; + + return { ...provided, opacity, transition }; + } +} + function EntrySelect(props: ({ entries: E[] } | { @@ -18,9 +43,10 @@ function EntrySelect(props: ({ name: string | undefined, isVerbSelect?: boolean, opts: T.TextOptions, + style?: StyleHTMLAttributes, }) { + const divStyle = props.style || { width: "13rem" }; const placeholder = "entries" in props ? "Select…" : "Search Pashto"; - const minWidth = "9rem"; function makeOption(e: E | T.DictionaryEntry) { if ("entry" in e) { return (props.isVerbSelect ? makeVerbSelectOption : makeSelectOption)(e, props.opts); @@ -42,16 +68,17 @@ function EntrySelect(props: ({ if (!s) return; props.onChange(s); } - return
+ return
; } @@ -76,15 +103,16 @@ function EntrySelect(props: ({ if (!s) return; props.onChange(s); } - return
+ return