From 9cfbfa3e09f8c735ee123c6d85cc9708f1422983 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Tue, 2 Nov 2021 20:33:39 -0400 Subject: [PATCH] w gender colors --- package.json | 2 +- src/components/ButtonSelect.tsx | 4 +++- src/components/VerbTable.tsx | 7 ++----- src/lib/gender-colors.ts | 6 ++++++ src/library.ts | 2 ++ 5 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 src/lib/gender-colors.ts diff --git a/package.json b/package.json index 6606226..53046bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "1.3.9", + "version": "1.4.0", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", diff --git a/src/components/ButtonSelect.tsx b/src/components/ButtonSelect.tsx index 0e078f2..36d01f2 100644 --- a/src/components/ButtonSelect.tsx +++ b/src/components/ButtonSelect.tsx @@ -9,7 +9,7 @@ import classNames from "classnames"; type PickerProps = { - options: { label: any, value: string }[], + options: { label: any, value: string, color?: string }[], value: string, handleChange: (payload: string) => void, small?: boolean, @@ -33,6 +33,8 @@ function ButtonSelect(props: PickerProps) { onClick={() => props.handleChange(option.value)} style={props.xSmall ? { fontSize: "small", + ...option.color ? + { background: option.color } : {}, } : {}} > {option.label} diff --git a/src/components/VerbTable.tsx b/src/components/VerbTable.tsx index 0469d93..c890d98 100644 --- a/src/components/VerbTable.tsx +++ b/src/components/VerbTable.tsx @@ -14,7 +14,7 @@ import { } from "../lib/p-text-helpers"; import { isSentenceForm } from "../lib/misc-helpers"; import * as T from "../types"; - +import genderColors from "../lib/gender-colors"; const genderAbbrev = (gender: "masc" | "fem" | undefined): " m." | " f." | "" => ( gender === "masc" @@ -87,10 +87,7 @@ function VerbTable({ block, textOptions, english }: { const rowLabel = `${pers[i]}${genderAbbrev(gender)}`; const color = !gender ? "inherit" - : gender === "masc" - ? "#78c8ed" - : "#ff99aa"; - + : genderColors[gender]; return (