w gender colors

This commit is contained in:
lingdocs 2021-11-02 20:33:39 -04:00
parent f0ea6ee5e3
commit 9cfbfa3e09
5 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "1.3.9", "version": "1.4.0",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -9,7 +9,7 @@
import classNames from "classnames"; import classNames from "classnames";
type PickerProps = { type PickerProps = {
options: { label: any, value: string }[], options: { label: any, value: string, color?: string }[],
value: string, value: string,
handleChange: (payload: string) => void, handleChange: (payload: string) => void,
small?: boolean, small?: boolean,
@ -33,6 +33,8 @@ function ButtonSelect(props: PickerProps) {
onClick={() => props.handleChange(option.value)} onClick={() => props.handleChange(option.value)}
style={props.xSmall ? { style={props.xSmall ? {
fontSize: "small", fontSize: "small",
...option.color ?
{ background: option.color } : {},
} : {}} } : {}}
> >
{option.label} {option.label}

View File

@ -14,7 +14,7 @@ import {
} from "../lib/p-text-helpers"; } from "../lib/p-text-helpers";
import { isSentenceForm } from "../lib/misc-helpers"; import { isSentenceForm } from "../lib/misc-helpers";
import * as T from "../types"; import * as T from "../types";
import genderColors from "../lib/gender-colors";
const genderAbbrev = (gender: "masc" | "fem" | undefined): " m." | " f." | "" => ( const genderAbbrev = (gender: "masc" | "fem" | undefined): " m." | " f." | "" => (
gender === "masc" gender === "masc"
@ -87,10 +87,7 @@ function VerbTable({ block, textOptions, english }: {
const rowLabel = `${pers[i]}${genderAbbrev(gender)}`; const rowLabel = `${pers[i]}${genderAbbrev(gender)}`;
const color = !gender const color = !gender
? "inherit" ? "inherit"
: gender === "masc" : genderColors[gender];
? "#78c8ed"
: "#ff99aa";
return ( return (
<tr key={`${i}${gender}`}> <tr key={`${i}${gender}`}>
<th scope="row" style={{ color }}>{rowLabel}</th> <th scope="row" style={{ color }}>{rowLabel}</th>

6
src/lib/gender-colors.ts Normal file
View File

@ -0,0 +1,6 @@
const genderColors = {
masc: "#78c8ed",
fem: "#ff99aa",
};
export default genderColors;

View File

@ -96,6 +96,7 @@ import {
} from "./lib/accent-helpers"; } from "./lib/accent-helpers";
import defaultTextOptions from "./lib/default-text-options"; import defaultTextOptions from "./lib/default-text-options";
import * as grammarUnits from "./lib/grammar-units"; import * as grammarUnits from "./lib/grammar-units";
import genderColors from "./lib/gender-colors";
import * as Types from "./types"; import * as Types from "./types";
export { export {
@ -162,6 +163,7 @@ export {
dictionaryEntryTextFields, dictionaryEntryTextFields,
dictionaryEntryNumberFields, dictionaryEntryNumberFields,
dictionaryEntryBooleanFields, dictionaryEntryBooleanFields,
genderColors,
// TYPES // TYPES
Types, Types,
} }