This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.then(res => { | |
const { | |
matchsPlayed: { home: teamsMatchsPlayedHome, away: teamsMatchsPlayedAway}, | |
wins: { home: teamsStatsWinHome, away: teamsStatsWinAway }, | |
draws: { home: teamsStatsDrawHome, away: teamsStatsDrawAway }, | |
loses: { home: teamsStatsLoseHome, away: teamsStatsLoseAway } | |
} = res.data.api.statistics.matchs; | |
const teamStats = { | |
teamsMatchsPlayedHome, | |
teamsMatchsPlayedAway, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Styled Components</title> | |
</head> | |
<body> | |
<div id="main"> | |
<!-- This is where our React app will go --> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The action | |
export function increase(index) { | |
return { | |
type: 'INCREMENT_COORDINATES', | |
index | |
} | |
} | |
// Redux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'INCREMENT_COORDINATES' : | |
console.log("incrementing coordinates") | |
const a = action.index; | |
let string = state[a].d | |
let array = string.split(' ') | |
let num = 5 | |
let neWd = array.map(x => x === 'M' || x === 'L' ? x : +x + 5).join(' ') | |
console.log(neWd) | |
return [ | |
...state.slice(0,a), // before the one we are updating |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Chart from './Chart'; | |
import LineChart from './d3/LineChart'; | |
export default class ChartsGrid extends React.Component{ | |
render() { | |
const view = [480, 320]; | |
const trbl = [0, 0, 0, 0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> | |
<div class="container-fluid" id="js-app"> | |
</div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.2/react.min.js"></script> | |
<script src="https://fb.me/react-dom-15.0.2.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux-thunk/2.0.1/redux-thunk.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.4.5/react-redux.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div | |
id="js-app" | |
onClick="addData()" | |
></div> | |
<p>Click chart to add new value</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default class Manna extends React.Component { | |
InitVal = { | |
likes: 10, | |
code: "2", | |
size: 350, | |
d1: 1, | |
d2: .6875, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const svgs = [ | |
{ | |
"code":"BAcyDyQwcXX", | |
"viewBox":"0 0 70 70", | |
"w": "70", | |
"h": "70", | |
"fill" : "none", | |
"strokewidth": "1", | |
"stroke": "red", | |
"d": "M 35 0 L 37.51521614737791 11.069316892700925 A 24.0625 24.0625 0 0 1 54.46697142714717 20.856417366712364 L 65.31088913245536 17.500000000000004 L 56.982187574525085 25.21289952598856 A 24.0625 24.0625 0 0 1 56.982187574525085 44.78710047401144 L 65.31088913245536 52.5 L 54.46697142714717 49.143582633287636 A 24.0625 24.0625 0 0 1 37.51521614737791 58.930683107299075 L 35 70 L 32.484783852622094 58.930683107299075 A 24.0625 24.0625 0 0 1 15.533028572852828 49.143582633287636 L 4.689110867544645 52.5 L 13.017812425474919 44.787100474011446 A 24.0625 24.0625 0 0 1 13.017812425474911 25.21289952598857 L 4.689110867544649 17.499999999999996 L 15.533028572852828 20.856417366712368 A 24.0625 24.0625 0 0 1 32.484783852622094 11.069316892700922" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var React = require('react') | |
var ReactDOMServer = require('react-dom/server') | |
var Manna = require('./Manna') | |
var Cog = require('./Cog') | |
var build = function(name, props) { | |
props.size = props.size || 64 | |
var size = props.size |
NewerOlder