diff --git a/README.md b/README.md new file mode 100644 index 0000000..9f7951f --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Crafity Snake + +## Todo + +[ ] Create welcome / instructions page +[ ] Link to repository +[ ] Convert components to use react hooks +[ ] Add license + +## License + +TODO diff --git a/src/containers/Keyboards.js b/src/containers/Keyboards.js new file mode 100644 index 0000000..acc5798 --- /dev/null +++ b/src/containers/Keyboards.js @@ -0,0 +1,54 @@ +import React from "react"; +import { connect } from "react-redux"; +import Title from "../components/Title.js"; +import List from "../components/List.js"; +import Button from "../components/Button.js"; +import Link from "../components/Link.js"; +import Spinner from "../components/Spinner.js"; +import { getKeyboards, showKeyboard } from "../redux/keyboards.js"; + +const KeyboardListItem = ({ item, showKeyboard }) => ( + + + {item.maker} - {item.model} + + +); + +const NoKeyboardsFound = ({ spinner }) => { + if (spinner) { + return

Loading...

; + } + return

There are no keyboards

; +}; + +class Keyboards extends React.Component { + componentDidMount() { + this.props.getKeyboards(); + } + render() { + const { keyboards, spinner, getKeyboards } = this.props; + return ( + + Keyboard List + + + {spinner && } + + ); + } +} +const mapState = ({ keyboards, ui }) => ({ + keyboards: keyboards.list, + spinner: ui.spinner +}); + +const mapActions = { + getKeyboards, + showKeyboard +}; + +export default connect( + mapState, + mapActions +)(Keyboards);