From 6de9a3451d8b97b99032e886cb62fd154a378cdd Mon Sep 17 00:00:00 2001 From: LASER-Yi Date: Wed, 21 Apr 2021 23:07:51 +0800 Subject: [PATCH] Add description text on providers selector --- .../src/Settings/Providers/components.tsx | 20 +++++++++++++++++++ frontend/src/components/inputs/Selector.tsx | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/frontend/src/Settings/Providers/components.tsx b/frontend/src/Settings/Providers/components.tsx index 6e3f7adeb..836505a29 100644 --- a/frontend/src/Settings/Providers/components.tsx +++ b/frontend/src/Settings/Providers/components.tsx @@ -6,6 +6,8 @@ import React, { useState, } from "react"; import { Button, Col, Container, Row } from "react-bootstrap"; +import { components } from "react-select"; +import { SelectComponents } from "react-select/src/components"; import { BaseModal, Selector, @@ -215,6 +217,23 @@ export const ProviderModal: FunctionComponent = () => { ); }, [info]); + const selectorComponents = useMemo< + Partial> + >( + () => ({ + Option: ({ data, ...other }) => { + const { label, value } = data as SelectorOption; + return ( + + {label} +

{value.description}

+
+ ); + }, + }), + [] + ); + return ( @@ -222,6 +241,7 @@ export const ProviderModal: FunctionComponent = () => { { @@ -15,6 +16,7 @@ export interface SelectorProps { label?: (item: T) => string; defaultValue?: SelectorValueType; value?: SelectorValueType; + components?: Partial>; } export function Selector( @@ -31,6 +33,7 @@ export function Selector( multiple, onChange, defaultValue, + components, value, } = props; @@ -83,6 +86,7 @@ export function Selector( isClearable={clearable} isDisabled={disabled} options={options} + components={components} className={`custom-selector w-100 ${className ?? ""}`} classNamePrefix="selector" onChange={(v) => {