more strings extractions (#963)

This commit is contained in:
Mihai C authored and GitHub committed 2021-10-15 10:53:42 +00:00
1 parent e1f4ba06d8
commit c4e2b6b458
20 files changed
+201 -112

No files matched your search

+5 -2
View File
@@ -1,6 +1,8 @@
import { CheckIcon, XIcon } from "@heroicons/react/outline";
import React, { ForwardedRef, useEffect, useState } from "react";
import { useLocale } from "@lib/hooks/useLocale";
import Avatar from "@components/ui/Avatar";
import Select from "@components/ui/form/Select";
@@ -21,6 +23,7 @@ export type CheckedSelectProps = {
export const CheckedSelect = React.forwardRef((props: CheckedSelectProps, ref: ForwardedRef<unknown>) => {
const [selectedOptions, setSelectedOptions] = useState<CheckedSelectValue>(props.defaultValue || []);
const { t } = useLocale();
useEffect(() => {
props.onChange(selectedOptions);
@@ -66,12 +69,12 @@ export const CheckedSelect = React.forwardRef((props: CheckedSelectProps, ref: F
}),
}}
name={props.name}
placeholder={props.placeholder || "Select..."}
placeholder={props.placeholder || t("select")}
isSearchable={false}
formatOptionLabel={formatOptionLabel}
options={options}
isMulti
value={props.placeholder || "Select..."}
value={props.placeholder || t("select")}
onChange={changeHandler}
/>
{selectedOptions.map((option) => (
+3 -1
View File
@@ -3,6 +3,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/r
import React from "react";
import classNames from "@lib/classNames";
import { useLocale } from "@lib/hooks/useLocale";
import { RadioArea, RadioAreaGroup } from "@components/ui/form/radio-area/RadioAreaGroup";
@@ -15,10 +16,11 @@ type RadioAreaSelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
};
export const Select = function RadioAreaSelect(props: RadioAreaSelectProps) {
const { t } = useLocale();
const {
options,
disabled = !options.length, // if not explicitly disabled and the options length is empty, disable anyway
placeholder = "Select...",
placeholder = t("select"),
} = props;
const getLabel = (value: string | ReadonlyArray<string> | number) =>