parent
0c38cddbfe
commit
000fccee42
@ -1,38 +0,0 @@
|
||||
import * as d3 from 'd3';
|
||||
|
||||
const url = 'https://udemy-react-d3.firebaseio.com/tallest_men.json';
|
||||
|
||||
const WIDTH = 800;
|
||||
const HEIGHT = 500;
|
||||
|
||||
export default class D3Chart {
|
||||
constructor(element) {
|
||||
const svg = d3
|
||||
.select(element)
|
||||
.append('svg')
|
||||
.attr('width', 800)
|
||||
.attr('height', 500);
|
||||
|
||||
d3.json(url).then((data) => {
|
||||
const max = d3.max(data, (d) => d.height);
|
||||
const y = d3.scaleLinear().domain([0, max]).range([0, HEIGHT]);
|
||||
|
||||
const x = d3
|
||||
.scaleBand()
|
||||
.domain(data.map((d) => d.name))
|
||||
.range([0, WIDTH])
|
||||
.padding(0.4);
|
||||
|
||||
const rects = svg.selectAll('rect').data(data);
|
||||
|
||||
rects
|
||||
.enter()
|
||||
.append('rect')
|
||||
.attr('x', (d) => x(d.name))
|
||||
.attr('y', (d) => HEIGHT - y(d.height))
|
||||
.attr('width', x.bandwidth)
|
||||
.attr('height', (d) => y(d.height))
|
||||
.attr('fill', 'grey');
|
||||
});
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Screen = styled.div`
|
||||
position: relative;
|
||||
|
||||
opacity: 0;
|
||||
animation: fade 0.4s ease-in forwards;
|
||||
background: black;
|
||||
|
||||
@keyframes fade {
|
||||
0% {
|
||||
opacity: 0.4;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.8;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const Balls = styled.div`
|
||||
display: flex;
|
||||
|
||||
.ball {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border-radius: 50%;
|
||||
background: red;
|
||||
margin: 0 6px 0 0;
|
||||
animation: oscillate 0.7s ease-in forwards infinite;
|
||||
}
|
||||
|
||||
.one {
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
.two {
|
||||
animation-delay: 1s;
|
||||
}
|
||||
.three {
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
@keyframes oscillate {
|
||||
0% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(20px);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const LoadingScreen = () => {
|
||||
return (
|
||||
<Screen>
|
||||
<Balls>
|
||||
<div className="ball one"></div>
|
||||
<div className="ball two"></div>
|
||||
<div className="ball three"></div>
|
||||
</Balls>
|
||||
</Screen>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoadingScreen;
|
@ -1,40 +0,0 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import Head from 'next/head';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const Bulles = dynamic(import('./Bulles'), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
const nbVotesPassables = 15;
|
||||
const nbVotesAssezBien = 200;
|
||||
const nbVotesBien = 389;
|
||||
const nbVotesTresBien = 12;
|
||||
const nbVotesExcellent = 2;
|
||||
|
||||
const resultats = [
|
||||
nbVotesPassables,
|
||||
nbVotesAssezBien,
|
||||
nbVotesBien,
|
||||
nbVotesTresBien,
|
||||
nbVotesExcellent,
|
||||
];
|
||||
|
||||
var totalVotes = 0;
|
||||
|
||||
for (var i = 0; i < resultats.length; i++) {
|
||||
totalVotes += resultats[i];
|
||||
}
|
||||
|
||||
function SystemeVote() {
|
||||
return (
|
||||
<Fragment>
|
||||
<Bulles donnees={resultats} />
|
||||
<p style={{ color: '#000000' }}>
|
||||
Le total des votes est de {totalVotes}.
|
||||
</p>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
export default SystemeVote;
|
@ -1,24 +0,0 @@
|
||||
/* eslint react/prop-types: 0 */
|
||||
import React from 'react';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faFacebookSquare } from '@fortawesome/free-brands-svg-icons';
|
||||
|
||||
const Facebook = (props) => {
|
||||
const handleClick = () => {
|
||||
const url =
|
||||
'https://www.facebook.com/sharer/sharer.php?u=' +
|
||||
props.url +
|
||||
'&t=' +
|
||||
props.title;
|
||||
window.open(
|
||||
url,
|
||||
'',
|
||||
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700'
|
||||
);
|
||||
};
|
||||
return <img src="/facebook.svg" onClick={handleClick} role="button" />;
|
||||
};
|
||||
|
||||
export default Facebook;
|
||||
|
||||
//i
|
@ -1,23 +0,0 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faCommentAlt } from '@fortawesome/free-solid-svg-icons';
|
||||
import { api } from '@services/api';
|
||||
|
||||
const Gform = (props) => {
|
||||
return (
|
||||
<a
|
||||
className={props.className}
|
||||
href={api.feedbackForm}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Votre avis nous intéresse !
|
||||
</a>
|
||||
);
|
||||
};
|
||||
|
||||
Gform.propTypes = {
|
||||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Gform;
|
@ -1,24 +0,0 @@
|
||||
/* eslint react/prop-types: 0 */
|
||||
import React from 'react';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faFacebookSquare } from '@fortawesome/free-brands-svg-icons';
|
||||
|
||||
const Twitter = (props) => {
|
||||
const handleClick = () => {
|
||||
const url =
|
||||
'https://twitter.com/intent/tweet?text=' +
|
||||
props.title +
|
||||
'&t=' +
|
||||
props.url;
|
||||
window.open(
|
||||
url,
|
||||
'',
|
||||
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700'
|
||||
);
|
||||
};
|
||||
return <img src="/twitter.svg" onClick={handleClick} role="button" />;
|
||||
};
|
||||
|
||||
export default Twitter;
|
||||
|
||||
//i
|
@ -1,4 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import FlagIconFactory from 'react-flag-icon-css';
|
||||
|
||||
export const FlagIcon = FlagIconFactory(React, { useCssModules: false });
|
@ -1,18 +0,0 @@
|
||||
import React from 'react';
|
||||
// import Plot from 'react-plotly.js';
|
||||
|
||||
const plot = () => (
|
||||
<div></div>
|
||||
// <Plot
|
||||
// data={[
|
||||
// {
|
||||
// type: 'bar',
|
||||
// x: ['Taubira', 'Hidalgo', 'Mélenchon'],
|
||||
// y: [29, 150, 85]
|
||||
// }
|
||||
// ]}
|
||||
// layout={{width: 1000, height: 500, title: 'Nombre de voix par candidat'}}
|
||||
// />
|
||||
);
|
||||
|
||||
export default plot;
|
Loading…
Reference in new issue