-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
388 additions
and
28 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
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 { html } from 'htm/react'; | ||
|
||
export default function MenuList() { | ||
function hello() { | ||
alert('eh'); | ||
} | ||
|
||
return html` | ||
<ul class='bp3-menu bp3-elevation-1'> | ||
<li> | ||
<a class='bp3-menu-item bp3-icon-people' tabindex='0' onClick='${hello}'> Share... </a> | ||
</li> | ||
<li> | ||
<a class='bp3-menu-item bp3-icon-circle-arrow-right' tabindex='0'> Move... </a> | ||
</li> | ||
<li> | ||
<a class='bp3-menu-item bp3-icon-edit' tabindex='0'> Rename </a> | ||
</li> | ||
<li class='bp3-menu-divider'></li> | ||
<li> | ||
<a class='bp3-menu-item bp3-icon-trash bp3-intent-danger' tabindex='0'> Delete </a> | ||
</li> | ||
</ul>`; | ||
} |
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
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
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
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
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
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,51 @@ | ||
import { html } from 'htm/react' | ||
import { render } from 'react-dom' | ||
import tippy from 'tippy.js' | ||
import './menu-list.less' | ||
import MenuList from '../components/MenuList' | ||
|
||
export default function initMenuListMode() { | ||
const targetElementId = 'mode-button-menuList' | ||
appendMenuListIcon(targetElementId) | ||
createMenuListContent() | ||
|
||
const dropdownElement = creatDropdownWrapper() | ||
const menuList = document.getElementById('menu-list-content') | ||
|
||
tippy(`#${targetElementId}`, { | ||
content: dropdownElement, | ||
allowHTML: true, | ||
theme: 'light-border', | ||
trigger: 'click', | ||
interactive: true, | ||
onShow: () => { | ||
dropdownElement.appendChild(menuList) | ||
}, | ||
onHidden: () => { | ||
document.body.appendChild(menuList) | ||
}, | ||
}) | ||
} | ||
|
||
function appendMenuListIcon(targetElementId) { | ||
var modeIcon = document.createElement('div') | ||
modeIcon.id = targetElementId | ||
modeIcon.className = `bp3-button bp3-minimal bp3-icon-full-stacked-chart bp3-small` | ||
|
||
var wrapper = document.querySelector('.rm-topbar') | ||
wrapper.appendChild(modeIcon) | ||
} | ||
|
||
function createMenuListContent() { | ||
const menuListContent = document.createElement('div') | ||
menuListContent.id = 'menu-list-content' | ||
document.body.appendChild(menuListContent) | ||
render(html`<${MenuList} />`, document.getElementById('menu-list-content')) | ||
} | ||
|
||
function creatDropdownWrapper() { | ||
const dropdownElement = document.createElement('div') | ||
dropdownElement.className = 'menu-list-dropdown' | ||
document.body.append(dropdownElement) | ||
return dropdownElement | ||
} |
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,7 @@ | ||
#menu-list-content { | ||
display: none; | ||
} | ||
|
||
.menu-list-dropdown #menu-list-content { | ||
display: block; | ||
} |
Oops, something went wrong.