change location of dropdown menu

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

@ -292,28 +292,7 @@ export function Workspace () {
) )
} }
return ( const workspaceMenuIcons = [
<div className='remixui_container'>
<div className='d-flex flex-column w-100 remixui_fileexplorer' data-id="remixUIWorkspaceExplorer" onClick={resetFocus}>
<div>
<header>
<div className="mx-2 mb-2">
<label className="pl-1 form-check-label" htmlFor="workspacesSelect">
Workspaces
</label>
<span className="remixui_menu">
<span
hidden={currentWorkspace === LOCALHOST}
id='workspaceCreate'
data-id='workspaceCreate'
onClick={(e) => {
e.stopPropagation()
createWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceCreate'])
}}
className='far fa-plus-square remixui_menuicon'
title='Create'>
</span>
<span <span
hidden={currentWorkspace === LOCALHOST || currentWorkspace === NO_WORKSPACE} hidden={currentWorkspace === LOCALHOST || currentWorkspace === NO_WORKSPACE}
id='workspaceRename' id='workspaceRename'
@ -325,7 +304,7 @@ export function Workspace () {
}} }}
className='far fa-edit remixui_menuicon' className='far fa-edit remixui_menuicon'
title='Rename'> title='Rename'>
</span> </span>,
<span <span
hidden={currentWorkspace === LOCALHOST || currentWorkspace === NO_WORKSPACE} hidden={currentWorkspace === LOCALHOST || currentWorkspace === NO_WORKSPACE}
id='workspaceDelete' id='workspaceDelete'
@ -337,7 +316,7 @@ export function Workspace () {
}} }}
className='far fa-trash remixui_menuicon' className='far fa-trash remixui_menuicon'
title='Delete'> title='Delete'>
</span> </span>,
<span <span
hidden={currentWorkspace === LOCALHOST || currentWorkspace === NO_WORKSPACE} hidden={currentWorkspace === LOCALHOST || currentWorkspace === NO_WORKSPACE}
id='workspacesDownload' id='workspacesDownload'
@ -349,7 +328,7 @@ export function Workspace () {
}} }}
className='far fa-download remixui_menuicon' className='far fa-download remixui_menuicon'
title='Download Workspaces'> title='Download Workspaces'>
</span> </span>,
<span <span
hidden={currentWorkspace === LOCALHOST} hidden={currentWorkspace === LOCALHOST}
id='workspacesRestore' id='workspacesRestore'
@ -361,7 +340,7 @@ export function Workspace () {
}} }}
className='far fa-upload remixui_menuicon' className='far fa-upload remixui_menuicon'
title='Restore Workspaces Backup'> title='Restore Workspaces Backup'>
</span> </span>,
<span <span
hidden={currentWorkspace === LOCALHOST} hidden={currentWorkspace === LOCALHOST}
id='cloneGitRepository' id='cloneGitRepository'
@ -374,7 +353,33 @@ export function Workspace () {
className='far fa-clone remixui_menuicon' className='far fa-clone remixui_menuicon'
title='Clone Git Repository'> title='Clone Git Repository'>
</span> </span>
]
return (
<div className='remixui_container'>
<div className='d-flex flex-column w-100 remixui_fileexplorer' data-id="remixUIWorkspaceExplorer" onClick={resetFocus}>
<div>
<header>
<div className="mx-2 mb-2 d-flex justify-content-between">
<label className="pl-1 form-check-label" htmlFor="workspacesSelect">
Workspaces
</label>
<span className="remixui_menu">
<span
hidden={currentWorkspace === LOCALHOST}
id='workspaceCreate'
data-id='workspaceCreate'
onClick={(e) => {
e.stopPropagation()
createWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceCreate'])
}}
className='far fa-plus-square remixui_menuicon'
title='Create'>
</span>
<span className="fas fa-bars remixui_menuicon"></span>
</span> </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}>
{ selectedWorkspace ? selectedWorkspace.name : currentWorkspace === LOCALHOST ? 'localhost' : NO_WORKSPACE } { selectedWorkspace ? selectedWorkspace.name : currentWorkspace === LOCALHOST ? 'localhost' : NO_WORKSPACE }
@ -414,6 +419,15 @@ export function Workspace () {
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
</div> </div>
<Dropdown className="custom-dropdown-items">
{
workspaceMenuIcons.map(m => (
<Dropdown.Item>
{m}
</Dropdown.Item>
))
}
</Dropdown>
</header> </header>
</div> </div>
<div className='h-100 remixui_fileExplorerTree' onFocus={() => { toggleDropdown(false) }}> <div className='h-100 remixui_fileExplorerTree' onFocus={() => { toggleDropdown(false) }}>

Loading…
Cancel
Save