diff --git a/step1-07/README.md b/step1-07/README.md
index a133f51..afe754e 100644
--- a/step1-07/README.md
+++ b/step1-07/README.md
@@ -160,20 +160,29 @@ const { label, completed, complete, id } = this.props;
And then use the input's `onChange` event to fire our `complete` callback. We can see in the signature that we expect and `id` of type string, so we'll pass our `id` prop in.
+```tsx
+ complete(id)} />
+```
+
> Note that the function param and prop name just happen to be the same. This isn't required.
-TodoListItemProps, extend, id, complete (possible abstraction)
-add props, add complete to List item
+## Exercise
-## List
+### TodoFooter
-Demo how you can't add random things to TodoListItem or item's this.props now
+1. Open TodoFooter and write a TodoFooterProps interface. It should include two values, a function and an object. Assign this interface to props like this: `(props: TodoFooterProps)`
+2. Write an `_onClick` function that calls `props.clear`.
+ > Since TodoFooter is not a class the `_onClick` needs to be declared as a const, and placed before the `return`.
+3. Add `_onClick` to the button's `onClick`. You won't need to use `this` since this isn't a class.
+ > We can't assign our `clear` function directly to `onClick`. We always need to create a function that calls our callbacks. `() => props.clear()`
+4. Test out this functionality. Check a few todos complete and click the `Clear Completed` button
-exercise
+### TodoHeader
-Add types to footer
-Add onClick to button
-Add types to header
-Add setFilter to filter buttons
-write onAdd function
-place onAdd to submit button
+1. Open TodoHeader and write TodoHeaderProps which will include 3 values. Replace the first `any` with this interface.
+2. This component also has state. Write TodoHeaderState (there's just one item), and add this where the second `any` was.
+3. Add `_onFilter` to each of the filter buttons
+ > Note that we can't add new parameters to onClick, but we can pull information from the event target!
+4. Write an `_onAdd` method that calls `addTodo` on the current `labelInput`, then sets the `labelInput` in state to an empty string
+5. Call `_onAdd` from the submit button
+6. Check out this new functionality! We can now add and filter todos!
diff --git a/step1-07/demo/src/components/TodoHeader.tsx b/step1-07/demo/src/components/TodoHeader.tsx
index 0608661..1d5cf5b 100644
--- a/step1-07/demo/src/components/TodoHeader.tsx
+++ b/step1-07/demo/src/components/TodoHeader.tsx
@@ -17,9 +17,9 @@ export class TodoHeader extends React.Component {
);
diff --git a/step1-07/exercise/src/components/TodoHeader.tsx b/step1-07/exercise/src/components/TodoHeader.tsx
index 0608661..8878c1c 100644
--- a/step1-07/exercise/src/components/TodoHeader.tsx
+++ b/step1-07/exercise/src/components/TodoHeader.tsx
@@ -17,14 +17,18 @@ export class TodoHeader extends React.Component {
);
}
+ _onFilter = evt => {
+ this.props.setFilter(evt.target.textContet);
+ };
+
_onChange = evt => {
this.setState({ labelInput: evt.target.value });
};
diff --git a/step1-07/final/src/components/TodoFooter.tsx b/step1-07/final/src/components/TodoFooter.tsx
index 022529a..fdb75cc 100644
--- a/step1-07/final/src/components/TodoFooter.tsx
+++ b/step1-07/final/src/components/TodoFooter.tsx
@@ -7,12 +7,16 @@ interface TodoFooterProps {
export const TodoFooter = (props: TodoFooterProps) => {
const itemCount = Object.keys(props.todos).filter(id => !props.todos[id].completed).length;
+ const _onClick = () => {
+ props.clear();
+ };
+
return (
diff --git a/step1-07/final/src/components/TodoHeader.tsx b/step1-07/final/src/components/TodoHeader.tsx
index b71dd25..d1f18e3 100644
--- a/step1-07/final/src/components/TodoHeader.tsx
+++ b/step1-07/final/src/components/TodoHeader.tsx
@@ -7,7 +7,11 @@ interface TodoHeaderProps {
filter: FilterTypes;
}
-export class TodoHeader extends React.Component {
+interface TodoHeaderState {
+ labelInput: string;
+}
+
+export class TodoHeader extends React.Component {
constructor(props) {
super(props);
this.state = { labelInput: '' };
@@ -25,13 +29,13 @@ export class TodoHeader extends React.Component {
@@ -39,6 +43,10 @@ export class TodoHeader extends React.Component {
);
}
+ _onFilter = evt => {
+ this.props.setFilter(evt.target.textContet);
+ };
+
_onChange = evt => {
this.setState({ labelInput: evt.target.value });
};