Skip to content

Commit

Permalink
Add react-bootstrap and redesign todo list footer touse bootstrap button
Browse files Browse the repository at this point in the history
  • Loading branch information
estebano committed Nov 1, 2017
1 parent 81e810f commit 7430249
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions public/index.html
Expand Up @@ -2,6 +2,7 @@
<html lang="pl">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
</head>

<body>
Expand Down
3 changes: 1 addition & 2 deletions src/components/ToDoList/FilterLink.js
Expand Up @@ -11,8 +11,7 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = (dispatch, ownProps) => {
return {
onClick: () => {
debugger;

dispatch(setVisibilityFilter(ownProps.filter));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/ToDoList/Footer.js
Expand Up @@ -3,16 +3,16 @@ import FilterLink from './FilterLink'

const Footer = () => (
<p>
Show:
Show:<br/>
{' '}
<FilterLink filter="SHOW_ALL">
All
</FilterLink>
{', '}
{' '}
<FilterLink filter="SHOW_ACTIVE">
Active
</FilterLink>
{', '}
{' '}
<FilterLink filter="SHOW_COMPLETED">
Completed
</FilterLink>
Expand Down
15 changes: 7 additions & 8 deletions src/components/ToDoList/Link.js
@@ -1,26 +1,25 @@
import React from 'react'
import PropTypes from 'prop-types'
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'react-bootstrap';

class Link extends React.Component {
onClick = undefined;

constructor(props) {
super(props);
debugger;
this.onClick = props.onClick.bind(this);
}

render() {
if (this.props.active) {
return (<span>{this.props.children}</span>);
return (<Button bsStyle="primary" bpSize="small" disabled>{this.props.children}</Button>);
}
else {
return (
<a href="#" onClick={e => {
return (<Button bpStyle="primary" bpSize="small" onClick={e => {
e.preventDefault();
this.onClick();
}}>
{this.props.children}
</a>
}}>{this.props.children}</Button>
);
}
}
Expand Down

0 comments on commit 7430249

Please sign in to comment.