JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://fb.me/JSXTransformer-0.10.0.js"></script>
<script src="http://fb.me/react-with-addons-0.10.0.js"></script>
<script src="http://fb.me/react-js-fiddle-integration.js"></script>
CSS
table {
border-collapse: collapse;
overflow: hidden;
z-index: 1;
width: 100%;
}
td, th, .row, .col, .ff-fix {
cursor: pointer;
padding: 10px;
position: relative;
}
tr, col {
border: 2px solid black;
}
th {
border-top: 3px solid black;
}
td:hover {
border: 2px solid red;
}
h2 {
font-family: sans-serif;
font-size: 22px;
padding: 5px;
margin-bottom: 5px;
border-bottom: 3px solid #669AFF;
color: #003366;
}
JavaScript 1.7
/** @jsx React.DOM */
var Search = React.createClass({
getInitialState: function() {
return { showResults: false };
},
_onContextMenu: function() {
this.setState({ showResults: true });
return false;
},
_onPageClick: function() {
if(this.state.showResults === true){
this.setState({ showResults: false })
}
},
render: function() {
return (
<div onClick={this._onPageClick}>
<div onContextMenu={this._onContextMenu} >
<table>
<col />
<tr>
<td>Status</td>
<td>Users</td>
<td>Condition</td>
</tr>
<tr>
<td>User Info</td>
<td>With Preferences</td>
<td>With Roles</td>
</tr>
<tr>
<td>Johnny</td>
<td>17</td>
<td>2</td>
</tr>
</table>
</div>
{ this.state.showResults ? <ContextMenu /> : null }
</div>
);
}
});
var ContextMenu = React.createClass({
render: function() {
return (
<div id="results">
Menu here
</div>
);
}
});
React.renderComponent( <Search /> , document.body);