Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atualização de gráficos com índice de transparência #160

Merged
merged 3 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"react-ga": "^3.3.0",
"react-modal": "^3.14.2",
"react-share": "^4.4.0",
"react-toggle-button": "^2.2.0",
"styled-components": "^5.2.3"
},
"devDependencies": {
Expand Down
Binary file removed public/img/indice.png
Binary file not shown.
Binary file added public/img/indice_mps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/indice_tjs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 29 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Head from 'next/head';
import styled from 'styled-components';
import { GetServerSideProps } from 'next';
import { useEffect, useMemo, useState } from 'react';
import ToggleButton from 'react-toggle-button'
import Footer from '../components/Footer';
import Nav from '../components/Header';
import DropDownGroupSelector from '../components/DropDownGroupSelector';
Expand Down Expand Up @@ -32,6 +33,7 @@ export default function Index({
[year],
);
const previousDateIsNavigable = useMemo<boolean>(() => year !== 2018, [year]);
const [indexChart, setIndexChart] = useState(true);
useEffect(() => {
fetchGeneralChartData();
}, [year]);
Expand Down Expand Up @@ -101,14 +103,32 @@ export default function Index({
</p>
<br />
<p>
Dados atualizados até <Negrito>8 Fev de 2022</Negrito>.
Dados atualizados até <Negrito>3 Mai de 2022</Negrito>.
</p>
<ToggleChartButton>
<ToggleButton
inactiveLabel={'MP'}
activeLabel={'TJ'}
colors={{
active: {
base: '#3e5363',
},
inactive: {
base: '#3e5363',
}
}}
value={indexChart}
onToggle={value => {
setIndexChart(!value);
}}/>
</ToggleChartButton>
<ImgGraph>
<img
src="/img/indice_legenda.png"
alt="Legenda do índice de transparência"
/>
<img src="/img/indice.png" alt="Índice de transparência" />
{indexChart && <img src="/img/indice_tjs.png" alt="Índice de transparência" />}
{!indexChart && <img src="/img/indice_mps.png" alt="Índice de transparência" />}
</ImgGraph>
</section>
</GraphWrapper>
Expand Down Expand Up @@ -363,3 +383,10 @@ const Negrito = styled.span`
font-weight: 700;
font-size: 1.8rem;
`;
const ToggleChartButton = styled.div`
display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding-top: 4rem;
`;
45 changes: 44 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2574,6 +2574,16 @@ pbkdf2@^3.0.3:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

performance-now@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5"
integrity sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=

performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=

picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.3.tgz#465547f359ccc206d3c48e46a1bcb89bf7ee619d"
Expand Down Expand Up @@ -2682,6 +2692,15 @@ [email protected], prop-types@^15.5.7, prop-types@^15.7.2:
object-assign "^4.1.1"
react-is "^16.8.1"

prop-types@^15.5.8, prop-types@^15.6.0:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
dependencies:
loose-envify "^1.4.0"
object-assign "^4.1.1"
react-is "^16.13.1"

public-encrypt@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0"
Expand Down Expand Up @@ -2729,6 +2748,13 @@ queue-microtask@^1.2.2:
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

raf@^3.1.0:
version "3.4.1"
resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"
integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==
dependencies:
performance-now "^2.1.0"

randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
Expand Down Expand Up @@ -2775,7 +2801,7 @@ react-ga@^3.3.0:
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.3.0.tgz#c91f407198adcb3b49e2bc5c12b3fe460039b3ca"
integrity sha512-o8RScHj6Lb8cwy3GMrVH6NJvL+y0zpJvKtc0+wmH7Bt23rszJmnqEQxRbyrqUzk9DTJIHoP42bfO5rswC9SWBQ==

[email protected], react-is@^16.7.0, react-is@^16.8.1:
[email protected], react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
Expand All @@ -2795,6 +2821,15 @@ react-modal@^3.14.2:
react-lifecycles-compat "^3.0.0"
warning "^4.0.3"

react-motion@^0.5.2:
version "0.5.2"
resolved "https://registry.yarnpkg.com/react-motion/-/react-motion-0.5.2.tgz#0dd3a69e411316567927917c6626551ba0607316"
integrity sha512-9q3YAvHoUiWlP3cK0v+w1N5Z23HXMj4IF4YuvjvWegWqNPfLXsOBE/V7UvQGpXxHFKRQQcNcVQE31g9SB/6qgQ==
dependencies:
performance-now "^0.2.0"
prop-types "^15.5.8"
raf "^3.1.0"

[email protected]:
version "0.8.3"
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f"
Expand All @@ -2808,6 +2843,14 @@ react-share@^4.4.0:
classnames "^2.2.5"
jsonp "^0.2.1"

react-toggle-button@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/react-toggle-button/-/react-toggle-button-2.2.0.tgz#a1b92143aa0df414642fcb141f0879f545bc5a89"
integrity sha1-obkhQ6oN9BRkL8sUHwh59UW8Wok=
dependencies:
prop-types "^15.6.0"
react-motion "^0.5.2"

[email protected]:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
Expand Down