Skip to content

Commit

Permalink
Recovered drop-down default button action (#32)
Browse files Browse the repository at this point in the history
* recovered default action

* 1.0.20
  • Loading branch information
dnenov authored Sep 20, 2024
1 parent 2aac9ed commit f8169d1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dynamods/dynamo-home",
"version": "1.0.19",
"version": "1.0.20",
"description": "Dynamo Home",
"author": "Autodesk Inc.",
"main": "index.tsx",
Expand Down
14 changes: 8 additions & 6 deletions src/components/Sidebar/CustomDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const CustomDropdown = ({
const dropdownRef = useRef(null);
const arrowColor = isOpen ? "rgba(56,171,223,0.35)" : "#949494";

const toggleDropdown = () => setIsOpen(!isOpen);
const toggleDropdown = () => setIsOpen(!isOpen);

/** Peforms the selected action type when used as a Drop-down */
const handleOptionSelect = (option: option) => {
Expand Down Expand Up @@ -67,18 +67,20 @@ export const CustomDropdown = ({
ref={dropdownRef}>
<div
className={styles['dropdown-selected']}
onClick={wholeButtonActionable ? toggleDropdown : undefined}
onClick={wholeButtonActionable ? toggleDropdown : handleDefaultAction} // Button behavior depends on wholeButtonActionable
>
<span>{placeholder}</span>
<span>{placeholder}</span>
{showDivider && <span className={styles['vertical-line']}></span>}
<div
className={styles['arrow-container']}
onClick={wholeButtonActionable ? undefined : (e) => {
onClick={(e) => {
e.stopPropagation();
toggleDropdown();
toggleDropdown(); // Arrow always toggles the dropdown
}}
>
<OpenArrow isOpen={isOpen} color={arrowColor} />
<div style={{ marginTop: 4 }}>
<OpenArrow isOpen={isOpen} color={arrowColor} />
</div>
</div>
</div>
<div className={`${styles['dropdown-options']} ${isOpen ? styles.open : ''}`}>
Expand Down

0 comments on commit f8169d1

Please sign in to comment.