Skip to content

Commit

Permalink
add badge page, add badge, fixed padding for landing page
Browse files Browse the repository at this point in the history
Co-authored-by: My Hoa Tien <[email protected]>Relates #10
  • Loading branch information
RihardsJ committed Oct 21, 2020
1 parent fcdf5c6 commit 4c679a0
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 64 deletions.
48 changes: 17 additions & 31 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
.App {
/* root colours and fonts go there */
/* light grey */
--color-1: hsl(225.8, 23.5%, 68.2%);

/* mustard yellow */
--color-2: hsl(52.5, 65.4%, 47.6%);

/* cyan */
--color-3: hsl(167.4, 67.3%, 55.7%);

/* dark grey */
--color-4: hsl(224.2, 17.1%, 21.8%);

/* white */
--color-5: hsl(0, 0%, 100%);

--title-font: 'Orbitron', sans-serif;
--info-font: 'Aldrich', sans-serif;
}

.App {
height: 100vh;
background-color: var(--color-4);
display: flex;
flex-direction: column;
align-items: center;
}

@keyframes globe {
Expand All @@ -35,6 +15,7 @@

.globe {
height: 10rem;
width: 10rem;
background-image: url(./images/globe.svg);
background-repeat: no-repeat;
background-size: contain;
Expand All @@ -51,26 +32,31 @@
background-repeat: no-repeat;
background-size: contain;
background-position: center;
animation-iteration-count: infinite;
animation-timing-function: linear;
}

.skull {
height: 10rem;
height: 12rem;
width: 12rem;
background-image: url(./images/skull.svg);
background-repeat: no-repeat;
background-size: contain;
background-position: center;
animation-iteration-count: infinite;
animation-timing-function: linear;
}

.alert {
height: 10rem;
height: 12rem;
width: 12rem;
background-image: url(./images/alert.svg);
background-repeat: no-repeat;
background-size: contain;
background-position: center;
animation-iteration-count: infinite;
animation-timing-function: linear;
}

.badge {
height: 12rem;
width: 12rem;
background-image: url(./images/badge.svg);
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
9 changes: 7 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import TrainingManual from './pages/trainingManual';
import FirstCasePage from './pages/firstCasePage';
import Profile from './pages/profile';
import TryAgain from './pages/tryAgain';
import GameOver from './pages/gameover';
import GameOver from './pages/gameoverPage';
import BadgePage from './pages/badgePage';

function App() {
const [points, setPoints] = React.useState(2);
const badgeType = 'Troll Hunter';
const alias = 'BrownFox';

return (
<BrowserRouter>
Expand Down Expand Up @@ -38,7 +41,9 @@ function App() {
<TryAgain />
</Route>
<Route path="/success" exact></Route>
<Route path="/badge" exact></Route>
<Route path="/badge" exact>
<BadgePage badgeType={badgeType} alias={alias} />
</Route>
<Route path="/second-case-intro" exact></Route>
<Route path="/second-case-task" exact></Route>
<Route path="/third-case-intro" exact></Route>
Expand Down
25 changes: 25 additions & 0 deletions src/components/Image.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
import styled from 'styled-components';
import React from 'react';

export const Img = styled.img`
width: 80vw;
height: 60vh;
border: solid red 3px;
`;

const BadgeImage = styled.div``;

const BadgeContainer = styled.div`
border: 5px solid;
padding: 2rem;
border-radius: 50px;
border-color: ${props => props.theme.borderColor};
`;

const BadgeTitle = styled.h2`
color: ${props => props.theme.badgeTextColor};
font-family: var(--title-font);
margin-top: 0;
`;

export const Badge = ({ badgeType }) => {
return (
<BadgeContainer>
<BadgeTitle>{badgeType}</BadgeTitle>
<BadgeImage className="badge" />
</BadgeContainer>
);
};
11 changes: 11 additions & 0 deletions src/components/themes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { findByLabelText } from '@testing-library/react';

export const landingPageTheme = {
btnColor: 'var(--color-2)',
btnTextColor: 'var(--color-4)',
Expand Down Expand Up @@ -28,3 +30,12 @@ export const gameOverPageTheme = {
btnColor: 'var(--color-3)',
btnTextColor: 'var(--color-4)'
};

export const badgePageTheme = {
textColor: 'var(--color-5)',
badgeTextColor: 'var(--color-2)',
h1Color: 'var(--color-3)',
btnColor: 'var(--color-3)',
btnTextColor: 'var(--color-4)',
borderColor: 'var(--color-1)'
};
3 changes: 3 additions & 0 deletions src/images/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 23 additions & 8 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
:root {
/* root colours and fonts go there */
/* light grey */
--color-1: hsl(225.8, 23.5%, 68.2%);

/* mustard yellow */
--color-2: hsl(52.5, 65.4%, 47.6%);

/* cyan */
--color-3: hsl(167.4, 67.3%, 55.7%);

/* dark grey */
--color-4: hsl(224.2, 17.1%, 21.8%);

/* white */
--color-5: hsl(0, 0%, 100%);

--title-font: 'Orbitron', sans-serif;
--info-font: 'Aldrich', sans-serif;
}

body {
text-align: center;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
background-color: var(--color-4);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
19 changes: 19 additions & 0 deletions src/pages/badgePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { badgePageTheme } from './../components/themes';
import { H1, Text } from './../components/Text';
import { Badge } from './../components/Image';
import { Button } from './../components/Buttons';

const BadgePage = ({ alias, badgeType }) => {
return (
<ThemeProvider theme={badgePageTheme}>
<H1>You earned the badge!</H1>
<Text>Well done {alias}!</Text>
<Badge badgeType={badgeType} />
<Button>Accept</Button>
</ThemeProvider>
);
};

export default BadgePage;
2 changes: 1 addition & 1 deletion src/pages/gameover.js → src/pages/gameoverPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ThemeProvider } from 'styled-components';

import { H1, H2 } from '../components/Text';
import { Container } from '../components/Forms';
import { gameOverPageTheme } from './../components/themes';
import { gameOverPageTheme } from '../components/themes';

const GameOver = () => {
const history = useHistory();
Expand Down
14 changes: 6 additions & 8 deletions src/pages/landingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ import { LandingPageForm } from './../components/Forms';
import { ThemeProvider } from 'styled-components';
import { landingPageTheme } from './../components/themes';
import { useHistory } from 'react-router-dom';
import { Container } from './../components/Forms';
// import { Container } from './../components/Forms';

const LandingPage = () => {
const history = useHistory();
history.push('/');
return (
<Container>
<ThemeProvider theme={landingPageTheme}>
<Title />
<div className="globe" />
<LandingPageForm />
</ThemeProvider>
</Container>
<ThemeProvider theme={landingPageTheme}>
<Title />
<div className="globe" />
<LandingPageForm />
</ThemeProvider>
);
};

Expand Down
25 changes: 11 additions & 14 deletions src/pages/tryAgain.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useHistory } from 'react-router-dom';
import { ThemeProvider } from 'styled-components';

import { H1, H2 } from '../components/Text';
import { Container } from '../components/Forms';
import { gameOverPageTheme } from './../components/themes';

const TryAgain = () => {
Expand All @@ -15,19 +14,17 @@ const TryAgain = () => {
};

return (
<Container>
<ThemeProvider theme={gameOverPageTheme}>
<H1>Incorrect!</H1>
<div className="alert" />
<H2>
Have a look at the case again.
<br /> If you are unsure information is
<br /> true,try to look it up and see if more
<br /> than one trusted source is reporting it.
</H2>
<Button onClick={createProfile}>TRY AGAIN</Button>
</ThemeProvider>
</Container>
<ThemeProvider theme={gameOverPageTheme}>
<H1>Incorrect!</H1>
<div className="alert" />
<H2>
Have a look at the case again.
<br /> If you are unsure information is
<br /> true,try to look it up and see if more
<br /> than one trusted source is reporting it.
</H2>
<Button onClick={createProfile}>TRY AGAIN</Button>
</ThemeProvider>
);
};

Expand Down

0 comments on commit 4c679a0

Please sign in to comment.