GeezerVison is showing github.com — [Added] Accountant and general styles · J4ASDev/practices-react-stack@220d57f
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | body { | 2 | 2 | margin: 0; | 3 | 3 | padding: 0; | | 4 | + background: #fafafa; | | 5 | +} | | 6 | + | | 7 | +h3 { | | 8 | + font-size: 25px; | | 9 | + font-family: 'K2D', sans-serif; | | 10 | +} | | 11 | + | | 12 | +.container { | | 13 | + display: grid; | | 14 | + width: 100%; | | 15 | + height: 100vh; | | 16 | + grid-template-areas: "Counter TextChange" | | 17 | + "AddSong AddSong"; | 4 | 18 | } |
Collapse file Copy file name to clipboardExpand all lines: src/App.js +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import React, { Component } from 'react' | 2 | 2 |
| 3 | 3 | //Components | | 4 | +import Counter from './components/counter' | | 5 | +import TextChange from './components/textChange' | 4 | 6 | import Songs from './components/songs' | 5 | 7 |
| | 8 | + | 6 | 9 | //Styles | 7 | 10 | import './App.css' | 8 | 11 |
| 9 | 12 | class App extends Component { | 10 | 13 | render() { | 11 | 14 | return ( | 12 | | - <div> | | 15 | + <div className="container"> | | 16 | + <Counter /> | | 17 | + <TextChange /> | 13 | 18 | <Songs /> | 14 | 19 | </div> | 15 | 20 | ); | |
Collapse file Copy file name to clipboard +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import { INCREMENT, DECREMENT } from './types' | | 2 | + | | 3 | +export function onIncrement(){ | | 4 | + console.log("Incrementado") | | 5 | + return { | | 6 | + type: INCREMENT | | 7 | + } | | 8 | +} | | 9 | + | | 10 | +export function onDecrement() { | | 11 | + console.log("Decreciendo") | | 12 | + return { | | 13 | + type: DECREMENT | | 14 | + } | | 15 | +} |
Collapse file Copy file name to clipboard +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -export const ADD_SONG = 'ADD_SONG' | | 1 | +export const ADD_SONG = 'ADD_SONG' | | 2 | +export const INCREMENT = 'INCREMENT' | | 3 | +export const DECREMENT = 'DECREMENT' |
Collapse file Copy file name to clipboard +22Lines changed: 22 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +.containerCOUNTER { | | 2 | + display: grid; | | 3 | + justify-items: center; | | 4 | + grid-template-rows: 30% 70%; | | 5 | + grid-area: Counter; | | 6 | +} | | 7 | + | | 8 | +.containerCOUNTER button { | | 9 | + width: 90px; | | 10 | + color: white; | | 11 | + font-size: 25px; | | 12 | + background: rgba(0, 0, 0, .7); | | 13 | + border: none; | | 14 | + border-radius: 7px; | | 15 | + outline: none | | 16 | +} | | 17 | + | | 18 | +.containerCOUNTER span { | | 19 | + color: #19d7d1; | | 20 | + font-size: 80px; | | 21 | + font-family: 'K2D', sans-serif; | | 22 | +} |
Collapse file Copy file name to clipboard +41Lines changed: 41 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import React, { Component } from 'react' | | 2 | +import { connect } from 'react-redux'; | | 3 | +import * as actions from '../../actions/count' | | 4 | +import { bindActionCreators } from 'redux' | | 5 | + | | 6 | +import './counter.css' | | 7 | + | | 8 | +class Counter extends Component { | | 9 | + | | 10 | + render() { | | 11 | + const { actions: { onIncrement, onDecrement }, count } = this.props | | 12 | + return ( | | 13 | + <div className="containerCOUNTER"> | | 14 | + <div> | | 15 | + <h3>Counter</h3> | | 16 | + </div> | | 17 | + <div> | | 18 | + <button onClick={onDecrement}> - </button> | | 19 | + <span>{count}</span> | | 20 | + <button onClick={onIncrement}> + </button> | | 21 | + </div> | | 22 | + </div> | | 23 | + ) | | 24 | + } | | 25 | +} | | 26 | + | | 27 | +function mapStateToProps (state) { | | 28 | + const { count } = state | | 29 | + | | 30 | + return { | | 31 | + count | | 32 | + } | | 33 | +} | | 34 | + | | 35 | +function mapDispatchToProps (dispatch){ | | 36 | + return { | | 37 | + actions: bindActionCreators(actions, dispatch) | | 38 | + } | | 39 | +} | | 40 | + | | 41 | +export default connect(mapStateToProps, mapDispatchToProps)(Counter) |
Collapse file Copy file name to clipboardExpand all lines: src/components/songs/index.jsx +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,12 +18,14 @@ class Songs extends Component { | 18 | 18 | const { songs } = this.props | 19 | 19 | return ( | 20 | 20 | <div className="containerFORM"> | | 21 | + <h3>Add Songs</h3> | 21 | 22 | <form onSubmit={this.handleFormSubmit}> | 22 | 23 | <input | 23 | 24 | type="text" | 24 | 25 | name="username" | 25 | 26 | ref={elemente => (this.input = elemente)} | 26 | 27 | placeholder="Name of the song" | | 28 | + formMethod="post" | 27 | 29 | /> | 28 | 30 | </form> | 29 | 31 | <div className="containerFORM-songs"> | |
Collapse file Copy file name to clipboardExpand all lines: src/components/songs/songs.css +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | .containerFORM { | 2 | | - | | 2 | + grid-area: AddSong; | 3 | 3 | } | 4 | 4 |
| 5 | 5 | .containerFORM form { | |
Collapse file Copy file name to clipboard +16Lines changed: 16 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import initialState from '../state' | | 2 | +import { INCREMENT, DECREMENT } from '../actions/types'; | | 3 | + | | 4 | + | | 5 | +function count(state = initialState.count, action) { | | 6 | + switch (action.type) { | | 7 | + case INCREMENT: | | 8 | + return state + 1 | | 9 | + case DECREMENT: | | 10 | + return state - 1 | | 11 | + default: | | 12 | + return state; | | 13 | + } | | 14 | +} | | 15 | + | | 16 | +export default count |
Collapse file Copy file name to clipboardExpand all lines: src/reducers/index.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,9 +2,11 @@ import { combineReducers } from 'redux' | 2 | 2 |
| 3 | 3 | // Reducers | 4 | 4 | import songs from './songs' | | 5 | +import count from './count' | 5 | 6 |
| 6 | 7 | const reducers = combineReducers({ | 7 | | - songs | | 8 | + songs, | | 9 | + count | 8 | 10 | }) | 9 | 11 |
| 10 | 12 | export default reducers | |
|