Skip to content

Commit

Permalink
revert changes in dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
TalMalka123 committed Aug 13, 2023
1 parent 0ebaec8 commit 3e65e8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
16 changes: 0 additions & 16 deletions src/components/elements/dropdown/dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
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;
Expand All @@ -26,14 +18,6 @@
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 {
Expand Down
20 changes: 6 additions & 14 deletions src/components/elements/dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ export interface DropdownOption {

export interface DropdownProps {
kind?: 'basic' | 'radio' | 'checkbox';
width: number|string;
width: number;
label: string;
isCollapsed?: boolean;
options?: RadioButtonItemProps[];
initialChecked?: number | string;
onItemChecked?: (id: any) => void;
title?: string;
optionWidth?: number|string;
optionWidth?: number;
alignOptionsToTheRight?: boolean;
maxHeight?: number;
dropdownBoxColor?: string;
disabled?: boolean;
height?:number|string;
errored?: boolean;
helperText?:string;
}

export const Dropdown = ({
Expand All @@ -45,9 +42,6 @@ export const Dropdown = ({
maxHeight,
dropdownBoxColor = '#f8fafc',
disabled = false,
height,
errored,
helperText,
...props
}: DropdownProps & React.ButtonHTMLAttributes<HTMLDivElement>) => {
const dropdownRef = useRef(null);
Expand Down Expand Up @@ -113,17 +107,16 @@ export const Dropdown = ({
};
}, []);


return (
<div
ref={dropdownRef}
className="dagshub-dropdown"
style={{ width: width, height: height, cursor: disabled ? 'not-allowed' : 'pointer' }}
style={{ width, cursor: disabled ? 'not-allowed' : 'pointer' }}
{...props}
>
<div
className={classNames([`"dagshub-dropdown__box"`], { disabled })}
style={{ height: '100%', background: dropdownBoxColor, pointerEvents: disabled ? 'none' : 'all' }}
className="dagshub-dropdown__box"
style={{ background: dropdownBoxColor, pointerEvents: disabled ? 'none' : 'all' }}
onClick={() => setIsCollapsed(!isCollapsed)}
>
{(kind != 'checkbox' && checkedOptLabel) || label}
Expand All @@ -137,7 +130,7 @@ export const Dropdown = ({
{kind === 'checkbox' && !isCollapsed && (
<div
className={classNames('dagshub-dropdown__options', { right: alignOptionsToTheRight })}
style={{ maxHeight: maxHeight, width: optionWidth ? optionWidth : '100%' }}
style={{ maxHeight: maxHeight }}
>
{checkboxOptions?.map((opt: RadioButtonItemProps) => (
<Checkbox
Expand Down Expand Up @@ -192,7 +185,6 @@ export const Dropdown = ({
))}
</div>
)}
{helperText && <p className="helper-text">{helperText}</p>}
</div>
);
};

0 comments on commit 3e65e8a

Please sign in to comment.