-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Replace 3 buttons with drop-down (#4648)
Signed-off-by: Alex Collins <alex_collins@intuit.com>
- Loading branch information
Showing
4 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ git-ask-pass.sh | |
/site/ | ||
/.brew_home | ||
/go-diagrams/ | ||
/.run/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.drop-down-button { | ||
display: inline-block; | ||
|
||
.items { | ||
position: absolute; // hover at the bottom left of the containing element | ||
z-index: 1; // must above other elements | ||
box-shadow: 1px 1px 1px 1px; // add a small shadow to lift it off the page a tiny amount | ||
|
||
.item { | ||
border-radius: 0; // remove the 24px button radius which looks odd on a menu | ||
width: 100% | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from 'react'; | ||
import {ReactNode, useState} from 'react'; | ||
|
||
require('./drop-down-button.scss'); | ||
|
||
export const DropDownButton = ({onClick, items, children}: {onClick: () => void; children: ReactNode; items: {value: string; onClick: () => void}[]}) => { | ||
const [dropped, setDropped] = useState(false); | ||
return ( | ||
<div className='drop-down-button' onMouseEnter={() => setDropped(true)} onMouseLeave={() => setDropped(false)}> | ||
<button onClick={onClick} className='argo-button argo-button--base'> | ||
{children} <i className='fa fa-angle-down' /> | ||
</button> | ||
<div className='items' style={{display: !dropped && 'none'}}> | ||
{items.map(option => ( | ||
<div key={option.value}> | ||
<button className='argo-button argo-button--base item' onClick={option.onClick}> | ||
{option.value} | ||
</button> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters