Skip to content

Commit

Permalink
Restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
elinlutz committed Mar 29, 2020
1 parent b44a04d commit f49de84
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 220 deletions.
4 changes: 2 additions & 2 deletions src/components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const Layout = ({ children, pageName }) => {
<Helmet bodyAttributes={{ class: className }}>
<title>Coronaviruset COVID-19 i Sverige - Karta</title>
</Helmet>
<Header />
<div className="wrapper">
<Header />
<main>{children}</main>
{pageName == 'home' ? null : <Footer />}
</div>
{pageName == 'home' ? null : <Footer />}
</>
)
}
Expand Down
33 changes: 5 additions & 28 deletions src/components/cards/CounterSweden.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import React, { useState } from 'react'
import React from 'react'
import { useStaticQuery, graphql } from 'gatsby'

import Bubble from './Bubble'
import Container from 'components/Container'

const CounterSweden = ({
title,
number,
deathNumber,
view,
hospitalized,
type,
provinceState
}) => {
const CounterSweden = ({ number, deathNumber, view, hospitalized }) => {
const data = useStaticQuery(graphql`
query {
site {
Expand All @@ -21,14 +13,7 @@ const CounterSweden = ({
}
`)

const getUpdatedAt = () => {
const updatedAt = data.site.buildTimeZone
if (view == 'world') {
return updatedAt.substring(0, updatedAt.length - 6)
} else {
return updatedAt
}
}
const updatedAt = data.site.buildTimeZone

return (
<Container className="counterCard">
Expand All @@ -41,15 +26,7 @@ const CounterSweden = ({

<div className="confirmedNumberContainerTop">
<div className="numberContainer">
{number > 1000 ? (
<h2 className={view === 'world' ? 'hWorld' : 'hSweden'}>
{number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ')}
</h2>
) : (
<h1 className={view === 'world' ? 'hWorld' : 'hSweden'}>
{number}
</h1>
)}
<h2>{number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ')}</h2>
<div className="textContainer">
<h3>Bekräftade fall</h3>
</div>
Expand All @@ -75,7 +52,7 @@ const CounterSweden = ({
</div>
</div>
<Container className="updatedText">
<p>UPPDATERAT {getUpdatedAt()}</p>
<p>UPPDATERAT {updatedAt}</p>
</Container>
</Container>
)
Expand Down
22 changes: 7 additions & 15 deletions src/components/cards/CounterWorld.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const CounterWorld = ({ number, deathNumber, recovered, view }) => {

const updatedAt = data.site.buildTimeZone

const insertSpace = number => {
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ')
}

return (
<Container className="counterCard">
<Container className="header">
Expand All @@ -25,15 +29,7 @@ const CounterWorld = ({ number, deathNumber, recovered, view }) => {
</Container>
<div className="confirmedNumberContainerTop">
<div className="numberContainer">
{number > 1000 ? (
<h2 className={view === 'world' ? 'hWorld' : 'hSweden'}>
{number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ')}
</h2>
) : (
<h1 className={view === 'world' ? 'hWorld' : 'hSweden'}>
{number}
</h1>
)}
<h2>{insertSpace(number)}</h2>
<div className="textContainer">
<h3>Bekräftade fall</h3>
</div>
Expand All @@ -42,17 +38,13 @@ const CounterWorld = ({ number, deathNumber, recovered, view }) => {

<div className="confirmedNumberContainerBottom">
<div className="numberContainer">
<h2 className>
{recovered.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ')}
</h2>
<h2 className="bottomWorld">{insertSpace(recovered)}</h2>
<div className="textContainer">
<h3>Tillfrisknade</h3>
</div>
</div>
<div className="numberContainer">
<h2 className>
{deathNumber.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ')}
</h2>
<h2 className="bottomWorld">{insertSpace(deathNumber)}</h2>
<div className="textContainer">
<h3>Dödsfall</h3>
</div>
Expand Down
14 changes: 8 additions & 6 deletions src/pages/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import { Link } from 'gatsby'
const NotFoundPage = () => {
return (
<Layout pageName="404">
<Container type="content" className="text-center">
<h1>Sidan kan inte hittas</h1>
<p>Det finns tyvärr ingen sida på den här adressen.</p>
<Container className="main">
<Container type="content" className="text-center">
<h1>Sidan kan inte hittas</h1>
<p>Det finns tyvärr ingen sida på den här adressen.</p>

<Button className={'button'}>
<Link to={'/'}>Tillbaka till kartan</Link>
</Button>
<Button className={'button'}>
<Link to={'/'}>Tillbaka till kartan</Link>
</Button>
</Container>
</Container>
</Layout>
)
Expand Down
Loading

0 comments on commit f49de84

Please sign in to comment.