This repository has been archived by the owner on May 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add job menu with sigkill button * Complete job menu button
- Loading branch information
1 parent
4028ef3
commit 264ff76
Showing
9 changed files
with
158 additions
and
15 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
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,64 @@ | ||
import * as React from "react"; | ||
import * as css from "./css/main"; | ||
import {fontAwesome} from "./css/FontAwesome"; | ||
|
||
interface MenuItemProps { | ||
suggestion: string; | ||
onHover: () => void; | ||
onClick: () => void; | ||
isHighlighted: boolean; | ||
} | ||
|
||
const MenuItem = ({suggestion, onHover, onClick, isHighlighted}: MenuItemProps) => | ||
<li | ||
style={css.autocomplete.item(isHighlighted)} | ||
onMouseOver={onHover} | ||
onClick={onClick} | ||
className="floatingMenuItem" | ||
> | ||
<i style={css.suggestionIcon as any}>{fontAwesome.times}</i> | ||
<span style={css.autocomplete.value}>{suggestion}</span> | ||
</li>; | ||
|
||
export interface MenuItemData { | ||
text: string; | ||
action: () => void; | ||
}; | ||
|
||
interface Props { | ||
offsetTop: number; | ||
menuItems: MenuItemData[]; | ||
highlightedIndex: number; | ||
hide: () => void; | ||
} | ||
|
||
interface State { | ||
highlightedIndex: number; | ||
} | ||
|
||
export class FloatingMenu extends React.Component<Props, State> { | ||
constructor(props: Props) { | ||
super(props); | ||
|
||
this.state = { | ||
highlightedIndex: -1, | ||
}; | ||
} | ||
|
||
render() { | ||
const suggestionViews = this.props.menuItems.map((item, index) => <MenuItem | ||
suggestion={item.text} | ||
onHover={() => this.setState({highlightedIndex: index})} | ||
onClick={() => { | ||
item.action(); | ||
this.props.hide(); | ||
}} | ||
key={index} | ||
isHighlighted={index === this.state.highlightedIndex} | ||
/>); | ||
|
||
return <div style={css.floatingMenu.box(this.props.offsetTop)}> | ||
<ul style={css.autocomplete.suggestionsList}>{suggestionViews}</ul> | ||
</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
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
File renamed without changes.
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,2 @@ | ||
process.on('SIGTERM', () => console.log('Received SIGTERM')); | ||
setInterval(() => {}, 1000) |