toggle dropdown menu visibility

pull/3023/head
Joseph Izang 2 years ago committed by Aniket
parent fde6f4c2ef
commit d59369f198
  1. 45
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -15,6 +15,7 @@ export function Workspace () {
const [currentWorkspace, setCurrentWorkspace] = useState<string>(NO_WORKSPACE) const [currentWorkspace, setCurrentWorkspace] = useState<string>(NO_WORKSPACE)
const [selectedWorkspace, setSelectedWorkspace] = useState<{ name: string, isGitRepo: boolean}>(null) const [selectedWorkspace, setSelectedWorkspace] = useState<{ name: string, isGitRepo: boolean}>(null)
const [showDropdown, setShowDropdown] = useState<boolean>(false) const [showDropdown, setShowDropdown] = useState<boolean>(false)
const [showIconsMenu, hideIconsMenu] = useState<boolean>(false)
const displayOzCustomRef = useRef<HTMLDivElement>() const displayOzCustomRef = useRef<HTMLDivElement>()
const mintableCheckboxRef = useRef() const mintableCheckboxRef = useRef()
const burnableCheckboxRef = useRef() const burnableCheckboxRef = useRef()
@ -360,25 +361,27 @@ export function Workspace () {
<div className='d-flex flex-column w-100 remixui_fileexplorer' data-id="remixUIWorkspaceExplorer" onClick={resetFocus}> <div className='d-flex flex-column w-100 remixui_fileexplorer' data-id="remixUIWorkspaceExplorer" onClick={resetFocus}>
<div> <div>
<header> <header>
<div className="mx-2 mb-2 d-flex justify-content-between"> <div className="mx-2 mb-2 d-flex flex-column">
<label className="pl-1 form-check-label" htmlFor="workspacesSelect"> <div className="justify-content-between">
<label className="pl-1 form-check-label" htmlFor="workspacesSelect">
Workspaces Workspaces
</label> </label>
<span className="remixui_menu"> <span className="remixui_menu d-flex justify-content-between">
<span <span
hidden={currentWorkspace === LOCALHOST} hidden={currentWorkspace === LOCALHOST}
id='workspaceCreate' id='workspaceCreate'
data-id='workspaceCreate' data-id='workspaceCreate'
onClick={(e) => { onClick={(e) => {
e.stopPropagation() e.stopPropagation()
createWorkspace() createWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceCreate']) _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceCreate'])
}} }}
className='far fa-plus-square remixui_menuicon' className='far fa-plus-square remixui_menuicon'
title='Create'> title='Create'>
</span>
<span className="fas fa-bars remixui_menuicon"></span>
</span> </span>
<span className="fas fa-bars remixui_menuicon"></span> </div>
</span>
<Dropdown id="workspacesSelect" data-id="workspacesSelect" onToggle={toggleDropdown} show={showDropdown}> <Dropdown id="workspacesSelect" data-id="workspacesSelect" onToggle={toggleDropdown} show={showDropdown}>
<Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control" icon={selectedWorkspace && selectedWorkspace.isGitRepo && !(currentWorkspace === LOCALHOST) ? 'far fa-code-branch' : null}> <Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control" icon={selectedWorkspace && selectedWorkspace.isGitRepo && !(currentWorkspace === LOCALHOST) ? 'far fa-code-branch' : null}>
@ -419,7 +422,10 @@ export function Workspace () {
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
</div> </div>
<Dropdown className="custom-dropdown-items"> </header>
</div>
{
showIconsMenu && <Dropdown className="custom-dropdown-items">
{ {
workspaceMenuIcons.map(m => ( workspaceMenuIcons.map(m => (
<Dropdown.Item> <Dropdown.Item>
@ -428,8 +434,7 @@ export function Workspace () {
)) ))
} }
</Dropdown> </Dropdown>
</header> }
</div>
<div className='h-100 remixui_fileExplorerTree' onFocus={() => { toggleDropdown(false) }}> <div className='h-100 remixui_fileExplorerTree' onFocus={() => { toggleDropdown(false) }}>
<div className='h-100'> <div className='h-100'>
{ (global.fs.browser.isRequestingWorkspace || global.fs.browser.isRequestingCloning) && <div className="text-center py-5"><i className="fas fa-spinner fa-pulse fa-2x"></i></div>} { (global.fs.browser.isRequestingWorkspace || global.fs.browser.isRequestingCloning) && <div className="text-center py-5"><i className="fas fa-spinner fa-pulse fa-2x"></i></div>}

Loading…
Cancel
Save