From 28255894e911d4d1336b5265ea8fc9d64ea9c5b2 Mon Sep 17 00:00:00 2001 From: Thor-Herman Van Eggelen <theggele@stud.ntnu.no> Date: Thu, 24 Sep 2020 13:51:51 +0200 Subject: [PATCH] Add actual SVG files #9 --- frontend/src/Components/MainPage.tsx | 2 +- frontend/src/Components/usePoetry.tsx | 3 -- frontend/src/SVGs.tsx | 45 +++++++++------------------ frontend/src/react-app-env.d.ts | 6 ++++ 4 files changed, 21 insertions(+), 35 deletions(-) diff --git a/frontend/src/Components/MainPage.tsx b/frontend/src/Components/MainPage.tsx index e2a55d6..3656141 100644 --- a/frontend/src/Components/MainPage.tsx +++ b/frontend/src/Components/MainPage.tsx @@ -18,7 +18,7 @@ export const PageContext = React.createContext({ class MainPage extends React.Component<props, state> { - state = {currentPage: 1, totalPages: 11}; // Index of which page to render. 0 is the landing page + state = {currentPage: 0, totalPages: 8}; // Index of which page to render. 0 is the landing page determineRender() { // Decides what page will be rendered return this.state.currentPage === 0 ? <LandingPage/> : diff --git a/frontend/src/Components/usePoetry.tsx b/frontend/src/Components/usePoetry.tsx index 16c7602..ff0a69c 100644 --- a/frontend/src/Components/usePoetry.tsx +++ b/frontend/src/Components/usePoetry.tsx @@ -8,9 +8,6 @@ const poets = [ "William Morris", "Sidney Lanier", "Robert Herrick", - "Robert Burns", - "Edward Thomas", - "Richard Crashaw", ]; type dataResponse = { diff --git a/frontend/src/SVGs.tsx b/frontend/src/SVGs.tsx index 0832b24..8682392 100644 --- a/frontend/src/SVGs.tsx +++ b/frontend/src/SVGs.tsx @@ -1,35 +1,18 @@ import React from "react"; +import {ReactComponent as SVG1} from './SVG/svg1.svg'; +import {ReactComponent as SVG2} from "./SVG/svg2.svg"; +import {ReactComponent as SVG3} from "./SVG/svg3.svg"; +import {ReactComponent as SVG4} from "./SVG/svg4.svg"; +import {ReactComponent as SVG5} from "./SVG/svg5.svg"; +import {ReactComponent as SVG6} from "./SVG/svg6.svg"; +import {ReactComponent as SVG7} from "./SVG/svg7.svg"; export default [ // Collection of Artworks that will be displayed - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"blue"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"red"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"pink"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"black"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"brown"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"purple"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"yellow"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"green"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"gray"} /> - </svg>, - <svg viewBox={"0 0 200 80"}> - <rect width={"200"} height={80} fill={"teal"} /> - </svg>, - // TODO: ADD SVGS IN HERE + <SVG1/>, + <SVG2/>, + <SVG3/>, + <SVG4/>, + <SVG5/>, + <SVG6/>, + <SVG7/>, ]; diff --git a/frontend/src/react-app-env.d.ts b/frontend/src/react-app-env.d.ts index fe3e4de..fc546eb 100644 --- a/frontend/src/react-app-env.d.ts +++ b/frontend/src/react-app-env.d.ts @@ -2,4 +2,10 @@ declare module '*.mp3' { const src: string; export default src; +} +declare module '*.svg' { + import React = require('react'); + export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>; + const src: string; + export default src; } \ No newline at end of file -- GitLab