Added svgr to load svg
This commit is contained in:
parent
c9a404e6ec
commit
c2e886989b
8
custom.d.ts
vendored
8
custom.d.ts
vendored
@ -3,4 +3,10 @@ declare module "*.module.css" {
|
|||||||
export default classes;
|
export default classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "*.svg";
|
declare module "*.svg" {
|
||||||
|
const ref: React.RefForwardingComponent<
|
||||||
|
SVGSVGElement,
|
||||||
|
React.SVGAttributes<SVGSVGElement>
|
||||||
|
>;
|
||||||
|
export default ref;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "SNOWPACK_PUBLIC_API_URL=http://localhost:5000 SNOWPACK_PUBLIC_BASE_URL=http://localhost:8080 snowpack dev",
|
"dev": "SNOWPACK_PUBLIC_API_URL=http://localhost:8081 SNOWPACK_PUBLIC_BASE_URL=http://localhost:8080 snowpack dev",
|
||||||
"build": "snowpack build",
|
"build": "snowpack build",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
@ -11,12 +11,12 @@
|
|||||||
"@types/react-dom": "^17.0.3",
|
"@types/react-dom": "^17.0.3",
|
||||||
"@types/snowpack-env": "^2.3.3",
|
"@types/snowpack-env": "^2.3.3",
|
||||||
"snowpack": "^3.3.5",
|
"snowpack": "^3.3.5",
|
||||||
|
"snowpack-plugin-svgr": "^0.1.2",
|
||||||
"typescript": "^4.2.4"
|
"typescript": "^4.2.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"serve": "^12.0.0",
|
|
||||||
"wouter": "^2.7.4"
|
"wouter": "^2.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="372"
|
|
||||||
height="512"
|
|
||||||
viewBox="0 0 372 512"
|
viewBox="0 0 372 512"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
id="svg23656"
|
id="svg23656"
|
||||||
@ -13,45 +11,12 @@
|
|||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:svg="http://www.w3.org/2000/svg">
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
<sodipodi:namedview
|
|
||||||
id="namedview23658"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pagecheckerboard="true"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
showgrid="false"
|
|
||||||
units="px"
|
|
||||||
inkscape:zoom="1.4142136"
|
|
||||||
inkscape:cx="90.863221"
|
|
||||||
inkscape:cy="228.74904"
|
|
||||||
inkscape:window-width="1916"
|
|
||||||
inkscape:window-height="1048"
|
|
||||||
inkscape:window-x="2"
|
|
||||||
inkscape:window-y="30"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
inkscape:snap-object-midpoints="true"
|
|
||||||
inkscape:snap-center="true"
|
|
||||||
showguides="true"
|
|
||||||
inkscape:guide-bbox="true"
|
|
||||||
inkscape:snap-intersection-paths="false"
|
|
||||||
height="372px" />
|
|
||||||
<defs
|
<defs
|
||||||
id="defs23653" />
|
id="defs23653" />
|
||||||
<g
|
<g
|
||||||
inkscape:label="Layer 1"
|
inkscape:label="Layer 1"
|
||||||
inkscape:groupmode="layer"
|
inkscape:groupmode="layer"
|
||||||
id="layer1">
|
id="layer1">
|
||||||
<rect
|
|
||||||
style="fill:#feffff;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect9862"
|
|
||||||
width="372"
|
|
||||||
height="512"
|
|
||||||
x="0"
|
|
||||||
y="0" />
|
|
||||||
<g
|
<g
|
||||||
id="g9760">
|
id="g9760">
|
||||||
<path
|
<path
|
||||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.2 KiB |
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
/** @type {import("snowpack").SnowpackUserConfig } */
|
/** @type {import("snowpack").SnowpackUserConfig } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: ["@snowpack/plugin-typescript"],
|
plugins: ["@snowpack/plugin-typescript", "snowpack-plugin-svgr"],
|
||||||
packageOptions: {
|
packageOptions: {
|
||||||
polyfillNode: true,
|
polyfillNode: true,
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import styles from "./Navbar.module.css";
|
import styles from "./Navbar.module.css";
|
||||||
import logoIcon from "~/assets/logo.svg";
|
import LogoIcon from "~/assets/logo.svg";
|
||||||
import { useLocation, Link } from "wouter";
|
import { useLocation, Link } from "wouter";
|
||||||
|
|
||||||
export const Navbar = () => {
|
export const Navbar = () => {
|
||||||
@ -15,12 +15,7 @@ export const Navbar = () => {
|
|||||||
<Link href="/">
|
<Link href="/">
|
||||||
{path === "/" ? (
|
{path === "/" ? (
|
||||||
<a>
|
<a>
|
||||||
<img
|
<LogoIcon className={styles.logo} />
|
||||||
className={styles.logo}
|
|
||||||
src={logoIcon}
|
|
||||||
alt="Publite logotype"
|
|
||||||
title="Publite"
|
|
||||||
/>
|
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
<a className={styles.title}>Publite</a>
|
<a className={styles.title}>Publite</a>
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="372"
|
|
||||||
height="512"
|
|
||||||
viewBox="0 0 372 512"
|
viewBox="0 0 372 512"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
id="svg23656"
|
id="svg23656"
|
||||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
@ -2,8 +2,6 @@
|
|||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
width="120"
|
|
||||||
height="120"
|
|
||||||
viewBox="0 0 31.75 31.75"
|
viewBox="0 0 31.75 31.75"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
id="svg5"
|
id="svg5"
|
||||||
|
Before Width: | Height: | Size: 884 B After Width: | Height: | Size: 853 B |
@ -22,5 +22,6 @@
|
|||||||
|
|
||||||
.plus {
|
.plus {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
width: 30px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useLocation } from "wouter";
|
import { useLocation } from "wouter";
|
||||||
|
|
||||||
import plusIcon from "~/assets/plus.svg";
|
import PlusIcon from "~/assets/plus.svg";
|
||||||
import styles from "./AddBook.module.css";
|
import styles from "./AddBook.module.css";
|
||||||
|
|
||||||
export const AddBook = () => {
|
export const AddBook = () => {
|
||||||
@ -14,7 +14,7 @@ export const AddBook = () => {
|
|||||||
}}
|
}}
|
||||||
className={styles.container}
|
className={styles.container}
|
||||||
>
|
>
|
||||||
<img src={plusIcon} className={styles.plus} />
|
<PlusIcon className={styles.plus} />
|
||||||
<h1 className={styles.caption}>Add book</h1>
|
<h1 className={styles.caption}>Add book</h1>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useContext, useEffect, useState } from "react";
|
import React, { useContext, useEffect, useState } from "react";
|
||||||
import { useLocation } from "wouter";
|
import { useLocation } from "wouter";
|
||||||
|
|
||||||
import plusIcon from "~/assets/plus.svg";
|
import PlusIcon from "~/assets/plus.svg";
|
||||||
import styles from "./UploadForm.module.css";
|
import styles from "./UploadForm.module.css";
|
||||||
import { submitFile, validateResponse, validState } from "~/utils/api";
|
import { submitFile, validateResponse, validState } from "~/utils/api";
|
||||||
import { BookListContext } from "~/context";
|
import { BookListContext } from "~/context";
|
||||||
@ -51,7 +51,7 @@ export const UploadForm = ({ setLoading }: IPageProps) => {
|
|||||||
onDragOver={handleDragOver}
|
onDragOver={handleDragOver}
|
||||||
>
|
>
|
||||||
<label className={styles.label} htmlFor="file">
|
<label className={styles.label} htmlFor="file">
|
||||||
<img className={styles.plus} src={plusIcon} />
|
<PlusIcon className={styles.plus} />
|
||||||
<span>
|
<span>
|
||||||
Choose book file or drag and drop it
|
Choose book file or drag and drop it
|
||||||
<br />
|
<br />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user