Skip to content

Commit 1276b2b

Browse files
committed
added actions to proposal listing component
1 parent 873af4c commit 1276b2b

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

src/category-view/components/ProposalListing/ProposalListing.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const styles = theme => ({
4747

4848
class ProposalListing extends Component {
4949
render() {
50-
const { date, description, badges, isFollowing, classes, theme } = this.props;
50+
const { id, date, description, badges, isFollowing, classes, theme, follow, show } = this.props;
5151
const [ year, month, day ] = date.split('-');
5252

5353
return (
@@ -68,15 +68,28 @@ class ProposalListing extends Component {
6868
);
6969
})}
7070
</div>
71-
<Typography variant="body2" paragraph className={classes.description}>
71+
<Typography
72+
variant="body2"
73+
paragraph
74+
className={classes.description}
75+
>
7276
{description}
7377
</Typography>
7478
<div className={classes.actions}>
75-
<Button variant="raised" color="primary">
79+
<Button
80+
variant="raised"
81+
color="primary"
82+
onClick={() => show(id)}
83+
>
7684
Timeline
7785
</Button>
7886
{isFollowing ? null :
79-
<Button variant="raised" color="secondary" className={classes.button}>
87+
<Button
88+
variant="raised"
89+
color="secondary"
90+
className={classes.button}
91+
onClick={() => follow(id)}
92+
>
8093
Urmareste
8194
</Button>
8295
}
@@ -88,10 +101,13 @@ class ProposalListing extends Component {
88101
}
89102

90103
ProposalListing.propTypes = {
104+
id: PropTypes.number.isRequired,
91105
date: PropTypes.string.isRequired,
92106
description: PropTypes.string.isRequired,
93107
badges: PropTypes.arrayOf(PropTypes.object).isRequired,
94-
isFollowing: PropTypes.bool.isRequired
108+
isFollowing: PropTypes.bool.isRequired,
109+
follow: PropTypes.func.isRequired,
110+
show: PropTypes.func.isRequired
95111
};
96112

97113
export default withStyles(styles, { withTheme: true })(ProposalListing);

src/category-view/components/ProposalListing/ProposalListing.stories.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { linkTo } from '@storybook/addon-links';
77
import ProposalListing from './ProposalListing';
88

99
const props = {
10+
id: 1234,
1011
date: '2018-04-10',
1112
description: 'Propunere de lege pentru ratificarea Tratatului intre Romania si Republica Federativa a Braziliei',
1213
badges: [
@@ -18,7 +19,9 @@ const props = {
1819
label: 'Pe ordinea de zi',
1920
color: 'lightblue'
2021
}],
21-
isFollowing: false
22+
isFollowing: false,
23+
follow: action('follow proposal'),
24+
show: action('show proposal')
2225
};
2326

2427
storiesOf('Category View', module).add('ProposalListing', () => <ProposalListing {...props} />);

0 commit comments

Comments
 (0)