-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 changed files
with
52 additions
and
14 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 |
---|---|---|
@@ -1,13 +1,23 @@ | ||
import * as React from 'react' | ||
|
||
export class NavDropDownItem extends React.Component<{label: string}, any> { | ||
import {OnSelectCallback, Payload} from "./OnSelectCallback"; | ||
|
||
export class NavDropDownItem extends React.Component<{label: string, onSelect?: OnSelectCallback, payload?: Payload}, any> { | ||
static propTypes() { | ||
return { | ||
label: React.PropTypes.string.isRequired | ||
label: React.PropTypes.string.isRequired, | ||
onSelect: React.PropTypes.func, | ||
payload: React.PropTypes.object | ||
} | ||
} | ||
|
||
private handleSelect = () => { | ||
if (this.props.onSelect) { | ||
this.props.onSelect(this.props.payload); | ||
} | ||
}; | ||
|
||
render(): React.ReactElement<any> { | ||
return <li><a href="#">{this.props.label}</a></li> | ||
return <li><a onClick={this.handleSelect}>{this.props.label}</a></li> | ||
} | ||
} |
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,3 @@ | ||
export interface OnClearCallback { | ||
(id: string) | ||
} |
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,11 @@ | ||
export interface Payload { | ||
payload: any; | ||
} | ||
|
||
export interface CommandPayload extends Payload{ | ||
command: string; | ||
} | ||
|
||
export interface OnSelectCallback { | ||
(event: Payload) | ||
} |
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