Skip to content

Commit 02c6024

Browse files
committed
Minor changes
1 parent 1712fc9 commit 02c6024

File tree

5 files changed

+43
-16
lines changed

5 files changed

+43
-16
lines changed

components/table/readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ const TableTest = () => (
4040
| `model` | `Object` | | If true, component will be disabled.|
4141
| `heading` | `Bool` | `true` | If true, component will show a heading using model field names.|
4242
| `onChange` | `Function` | | Callback function that is fired when the components's value changes.|
43-
| `onSelect` | `Function` | | Callback function when clicks in a determinate row.|
43+
| `onSelect` | `Function` | | Callback function when selects a determinate row.|
4444

4545
## Methods
4646

4747
This component has state to control how is it rendered and the values currently selected. It exposes the following instance methods:
4848

4949
- `getValue` is used to retrieve the current dataSource.
50+
- `getSelected` is used to retrieve the current rows selected.

docs/app/components/layout/main/modules/examples/table_example_1.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ const users = [
1818
{name: 'Javi Velasco', twitter: '@javivelasco', birthdate: new Date(1987, 1, 1), dogs: 1, active: true}
1919
];
2020

21+
const handleSelect = (event, row, instance) => {
22+
alert(row.twitter);
23+
};
24+
2125
const TableTest = () => (
22-
<Table model={UserModel} dataSource={users} />
26+
<Table model={UserModel} dataSource={users} onSelect={handleSelect} />
2327
)
2428

2529
return <TableTest />

spec/components/table.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ const UserModel = {
1212
,
1313
dogs: {type: Number}
1414
,
15-
active: {type: Boolean}
15+
owner: {type: Boolean}
1616
};
1717

1818
const users = [
1919
{name: 'Javi Jimenez', twitter: '@soyjavi', birthdate: new Date(1980, 3, 11), cats: 1}
2020
,
2121
{name: 'Javi Velasco', twitter: '@javivelasco', birthdate: new Date(1987, 1, 1), dogs: 1, active: true}
22+
,
23+
{name: 'chinorro'}
2224
];
2325

2426
class TableTest extends React.Component {
@@ -27,8 +29,8 @@ class TableTest extends React.Component {
2729
console.log('handleTableChange', instance.getValue(), row);
2830
};
2931

30-
handleTableRowSelect = (event, row) => {
31-
console.log('handleTableRowSelect', row);
32+
handleTableRowSelect = (event, row, instance) => {
33+
console.log('handleTableRowSelect', row, this.refs.table.getSelected());
3234
};
3335

3436
render () {
@@ -37,6 +39,7 @@ class TableTest extends React.Component {
3739
<h5>Table</h5>
3840
<p style={{marginBottom: '10px'}}>Organized data.</p>
3941
<Table
42+
ref='table'
4043
model={UserModel}
4144
dataSource={users}
4245
onChange={this.handleTableChange}

spec/root.jsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React from 'react';
2+
23
import App from '../components/app';
3-
import AppBar from '../components/app_bar';
4+
import AppBarToolbox from '../components/app_bar';
5+
import ButtonToolbox from '../components/button';
6+
47
import Autocomplete from './components/autocomplete';
58
import Button from './components/button';
69
import Card from './components/card';
@@ -24,12 +27,22 @@ import Tabs from './components/tabs';
2427
// import Logo from '../docs/app/components/logo'
2528
import style from './style';
2629

30+
const _hrefProject = () => {
31+
window.href = 'http://react-toolbox';
32+
};
33+
2734
const Root = () => (
2835
<App className={style.app}>
29-
<AppBar fixed flat className={style.app_bar}>
30-
<h1>React Toolbox <small>Component Spec</small></h1>
31-
<small>v0.11.2</small>
32-
</AppBar>
36+
<AppBarToolbox fixed flat className={style.app_bar}>
37+
<h1>React Toolbox <small>Spec 0.11.2</small></h1>
38+
<ButtonToolbox
39+
accent
40+
className={style.github}
41+
icon='web'
42+
kind='floating'
43+
onClick={_hrefProject}
44+
/>
45+
</AppBarToolbox>
3346

3447
<Autocomplete />
3548
<Button />

spec/style.scss

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
$unit: 1rem;
1+
@import "../components/base";
2+
@import "../components/app_bar/config";
3+
@import "../components/button/config";
4+
25
$offset: 1.8 * $unit;
6+
37
.app {
48
padding: (8.2 * $unit) $offset $offset $offset;
59
background-color: #f5f5f5;
@@ -25,6 +29,13 @@ $offset: 1.8 * $unit;
2529
}
2630
}
2731

32+
.github {
33+
position: fixed;
34+
top: $appbar-height - ($button-floating-height / 2);
35+
right: $button-floating-height / 2;
36+
z-index: $z-index-higher;
37+
}
38+
2839
.app_bar {
2940
display: flex;
3041
> h1 {
@@ -36,11 +47,6 @@ $offset: 1.8 * $unit;
3647
font-weight: normal;
3748
}
3849
}
39-
> small {
40-
padding: (.5 * $unit) (.8 * $unit);
41-
font-size: 1.2 * $unit;
42-
background-color: rgba(0,0,0, .25);
43-
}
4450
}
4551

4652
.logo {

0 commit comments

Comments
 (0)