GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Added] Accountant and general styles · J4ASDev/practices-react-stack@220d57f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • App.css
    • App.js
    • actions
      • count.js
      • types
        • index.js
    • components
      • counter
        • counter.css
        • index.jsx
      • songs
        • index.jsx
        • songs.css
    • reducers
      • count.js
      • index.js
      • songs.js
    • state
      • index.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/App.css‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
body {
22
margin: 0;
33
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";
418
}
Collapse file

‎src/App.js‎

Copy file name to clipboardExpand all lines: src/App.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import React, { Component } from 'react'
22

33
//Components
4+
import Counter from './components/counter'
5+
import TextChange from './components/textChange'
46
import Songs from './components/songs'
57

8+
69
//Styles
710
import './App.css'
811

912
class App extends Component {
1013
render() {
1114
return (
12-
<div>
15+
<div className="container">
16+
<Counter />
17+
<TextChange />
1318
<Songs />
1419
</div>
1520
);
Collapse file

‎src/actions/count.js‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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

‎src/actions/types/index.js‎

Copy file name to clipboard
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
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

‎src/components/counter/counter.css‎

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

‎src/components/counter/index.jsx‎

Copy file name to clipboard
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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

‎src/components/songs/index.jsx‎

Copy file name to clipboardExpand all lines: src/components/songs/index.jsx
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ class Songs extends Component {
1818
const { songs } = this.props
1919
return (
2020
<div className="containerFORM">
21+
<h3>Add Songs</h3>
2122
<form onSubmit={this.handleFormSubmit}>
2223
<input
2324
type="text"
2425
name="username"
2526
ref={elemente => (this.input = elemente)}
2627
placeholder="Name of the song"
28+
formMethod="post"
2729
/>
2830
</form>
2931
<div className="containerFORM-songs">
Collapse file

‎src/components/songs/songs.css‎

Copy file name to clipboardExpand all lines: src/components/songs/songs.css
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.containerFORM {
2-
2+
grid-area: AddSong;
33
}
44

55
.containerFORM form {
Collapse file

‎src/reducers/count.js‎

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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

‎src/reducers/index.js‎

Copy file name to clipboardExpand all lines: src/reducers/index.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { combineReducers } from 'redux'
22

33
// Reducers
44
import songs from './songs'
5+
import count from './count'
56

67
const reducers = combineReducers({
7-
songs
8+
songs,
9+
count
810
})
911

1012
export default reducers

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.