Last active
August 29, 2015 14:24
-
-
Save mnishiguchi/2ecdbd8aa166f89760ef to your computer and use it in GitHub Desktop.
React.js - HAML風に書く方法 ref: http://qiita.com/mnishiguchi/items/5f5cd8d9d07f56a7360c
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
@Records = React.createClass | |
#... | |
render: -> | |
<div> | |
<table className='table table-bordered'> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Vol</th> | |
<th>Qty</th> | |
<th>Subtotal</th> | |
<th>Room</th> | |
<th>Category</th> | |
<th>Description</th> | |
<th></th> | |
</tr> | |
</thead> | |
<tbody> | |
{ for record in @state.records | |
<Record key={record.id} record={record} | |
handleDeleteRecord={this.deleteRecord} | |
handleEditRecord={this.updateRecord} /> | |
} | |
</tbody> | |
</table> | |
</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
@Records = React.createClass | |
#...(中略) | |
render: -> | |
<div className='moving_records table-responsive'> | |
<table className='table table-bordered table-condensed'> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Vol</th> | |
<th>Qty</th> | |
<th>Subtotal</th> | |
<th>Room</th> | |
<th>Category</th> | |
<th>Description</th> | |
<th></th> | |
</tr> | |
</thead> | |
<tbody> | |
{ for record in @state.records | |
<Record key={record.id} record={record} | |
handleDeleteRecord={this.deleteRecord} | |
handleEditRecord={this.updateRecord} /> | |
} | |
</tbody> | |
</table> | |
</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
@Records = React.createClass | |
#... | |
render: -> | |
React.DOM.div null, | |
React.DOM.table | |
className: 'table table-bordered' | |
React.DOM.thead null, | |
React.DOM.tr null, | |
React.DOM.th null, 'Name' | |
React.DOM.th null, 'Vol' | |
React.DOM.th null, 'Qty' | |
React.DOM.th null, 'Subtotal' | |
React.DOM.th null, 'Room' | |
React.DOM.th null, 'Category' | |
React.DOM.th null, 'Description' | |
React.DOM.th null, '' | |
React.DOM.tbody null, | |
for record in @state.records | |
React.createElement Record, | |
key: record.id, | |
record: record, | |
handleDeleteRecord: @deleteRecord, | |
handleEditRecord: @updateRecord |
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
@Records = React.createClass | |
#... | |
render: -> | |
div = React.DOM.div | |
table = React.DOM.table | |
thead = React.DOM.thead | |
tr = React.DOM.tr | |
th = React.DOM.th | |
tbody = React.DOM.tbody | |
div null, | |
table | |
className: 'table table-bordered' | |
thead | |
tr null, | |
th null, 'Name' | |
th null, 'Vol' | |
th null, 'Qty' | |
th null, 'Subtotal' | |
th null, 'Room' | |
th null, 'Category' | |
th null, 'Description' | |
th null, '' | |
tbody null, | |
for record in @state.records | |
React.createElement Record, | |
key: record.id, | |
record: record, | |
handleDeleteRecord: @deleteRecord, | |
handleEditRecord: @updateRecord |
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
R = React.DOM | |
@Records = React.createClass | |
#... | |
render: -> | |
div null, | |
table | |
className: 'table table-bordered' | |
R.thead | |
R.tr null, | |
R.th null, 'Name' | |
R.th null, 'Vol' | |
R.th null, 'Qty' | |
R.th null, 'Subtotal' | |
R.th null, 'Room' | |
R.th null, 'Category' | |
R.th null, 'Description' | |
R.th null, '' | |
R.tbody null, | |
for record in @state.records | |
React.createElement Record, | |
key: record.id, | |
record: record, | |
handleDeleteRecord: @deleteRecord, | |
handleEditRecord: @updateRecord |
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
@Records = React.createClass | |
#...(中略) | |
render: -> | |
div = React.DOM.div | |
hr = React.DOM.hr | |
table = React.DOM.table | |
thead = React.DOM.thead | |
tr = React.DOM.tr | |
th = React.DOM.th | |
tbody = React.DOM.tbody | |
div | |
className: 'moving_records table-responsive' | |
table | |
className: 'table table-bordered table-condensed' | |
thead | |
tr | |
th null, 'Name' | |
th null, 'Vol' | |
th null, 'Qty' | |
th null, 'Subtotal' | |
th null, 'Room' | |
th null, 'Category' | |
th null, 'Description' | |
th null, '' | |
tbody null, | |
for record in @state.records | |
React.createElement Record, | |
key: record.id, | |
record: record, | |
handleDeleteRecord: @deleteRecord, | |
handleEditRecord: @updateRecord | |
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
@Records = React.createClass | |
#...(中略) | |
render: -> | |
return | |
<div className='moving_records table-responsive'> | |
<table className='table table-bordered table-condensed'> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Vol</th> | |
<th>Qty</th> | |
<th>Subtotal</th> | |
<th>Room</th> | |
<th>Category</th> | |
<th>Description</th> | |
<th></th> | |
</tr> | |
</thead> | |
<tbody> | |
{ for record in @state.records | |
<Record key={record.id} record={record} | |
handleDeleteRecord={this.deleteRecord} | |
handleEditRecord={this.updateRecord} /> | |
} | |
</tbody> | |
</table> | |
</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
div | |
table | |
thead | |
tr | |
th 'Name' | |
th 'Vol' | |
th 'Qty' | |
th 'Subtotal' | |
th 'Room' | |
th 'Category' | |
th 'Description' | |
th '' | |
tbody | |
for record in @state.records | |
React.createElement Record |
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
%div | |
%table | |
%thead | |
%tr | |
%th 'Name' | |
%th 'Vol' | |
%th 'Qty' | |
%th 'Subtotal' | |
%th 'Room' | |
%th 'Category' | |
%th 'Description' | |
%th '' | |
%tbody | |
= render @records |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment