From 0ebaec8da5dbfaacf4cc2282a01672b0e1b18b2a Mon Sep 17 00:00:00 2001 From: Tal Malka Date: Wed, 9 Aug 2023 10:50:51 +0300 Subject: [PATCH] edited generic modal and dropdown --- .../modals/generic-modal/index.tsx | 4 ++-- .../elements/dropdown/dropdown.scss | 16 +++++++++++++++ src/components/elements/dropdown/index.tsx | 20 +++++++++++++------ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/components/dagshub/organization/modals/generic-modal/index.tsx b/src/components/dagshub/organization/modals/generic-modal/index.tsx index ff36d31f..60409e05 100644 --- a/src/components/dagshub/organization/modals/generic-modal/index.tsx +++ b/src/components/dagshub/organization/modals/generic-modal/index.tsx @@ -4,7 +4,7 @@ import './generic-modal.scss'; import { Icon } from '.././../../../icons/index'; export interface ModalProps { - title: string; + title?: string; elements: JSX.Element[]; onClose: () => void; height?: number; @@ -24,7 +24,7 @@ export function GenericModal({ title, elements, onClose, height, maxHeight }: Mo
-

{title}

+ {!!title&&

{title}

} {elements}
diff --git a/src/components/elements/dropdown/dropdown.scss b/src/components/elements/dropdown/dropdown.scss index b21c3938..73cf153c 100644 --- a/src/components/elements/dropdown/dropdown.scss +++ b/src/components/elements/dropdown/dropdown.scss @@ -3,6 +3,14 @@ white-space: pre-wrap; font-family: 'Inter', sans-serif; + .helper-text { + color: #64748b; + font-weight: 500; + font-size: 12px; + height: 16px; + margin: 0px; + } + .dagshub-dropdown__box { font-weight: 600; font-size: 14px; @@ -18,6 +26,14 @@ border: 1px solid var(--secondary-state-300); border-radius: 12px; cursor: pointer; + + .errored { + border-color: #ef4444; + } + + .errored .helper-text { + color: #ef4444; + } } .dagshub-dropdown__dropdown_title { diff --git a/src/components/elements/dropdown/index.tsx b/src/components/elements/dropdown/index.tsx index e1052cfc..81eedef6 100644 --- a/src/components/elements/dropdown/index.tsx +++ b/src/components/elements/dropdown/index.tsx @@ -15,18 +15,21 @@ export interface DropdownOption { export interface DropdownProps { kind?: 'basic' | 'radio' | 'checkbox'; - width: number; + width: number|string; label: string; isCollapsed?: boolean; options?: RadioButtonItemProps[]; initialChecked?: number | string; onItemChecked?: (id: any) => void; title?: string; - optionWidth?: number; + optionWidth?: number|string; alignOptionsToTheRight?: boolean; maxHeight?: number; dropdownBoxColor?: string; disabled?: boolean; + height?:number|string; + errored?: boolean; + helperText?:string; } export const Dropdown = ({ @@ -42,6 +45,9 @@ export const Dropdown = ({ maxHeight, dropdownBoxColor = '#f8fafc', disabled = false, + height, + errored, + helperText, ...props }: DropdownProps & React.ButtonHTMLAttributes) => { const dropdownRef = useRef(null); @@ -107,16 +113,17 @@ export const Dropdown = ({ }; }, []); + return (
setIsCollapsed(!isCollapsed)} > {(kind != 'checkbox' && checkedOptLabel) || label} @@ -130,7 +137,7 @@ export const Dropdown = ({ {kind === 'checkbox' && !isCollapsed && (
{checkboxOptions?.map((opt: RadioButtonItemProps) => ( )} + {helperText &&

{helperText}

}
); };