Skip to content

Commit 30f0f81

Browse files
committed
feat: Added a loading spinner
1 parent 4728770 commit 30f0f81

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

components/core/App.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
import React, { useEffect, useState } from "react";
22
import dynamic from "next/dynamic";
3+
4+
// harperDb fetch call
35
import { harperFetch } from "../../utils/HarperFetch";
46

5-
import { shapes } from "../../data/shapes";
7+
// Dummy Shape Data
8+
// import { shapes } from "../../data/shapes";
69

10+
// Toast
711
import toast from "react-hot-toast";
812

13+
// Clip-Path
914
const Shape = dynamic(import("react-clip-path"), { ssr: false });
15+
16+
// Switch
1017
import Switch from "react-switch";
1118

19+
// loader
20+
import Loader from "react-loader-spinner";
21+
1222
import {
1323
ShapeCards,
1424
ShapeCard,
@@ -32,10 +42,10 @@ const App = (props) => {
3242
setLoading(true);
3343

3444
// fetching the shape data
35-
/*const shapes = await harperFetch({
45+
const shapes = await harperFetch({
3646
operation: "sql",
3747
sql: "SELECT * FROM tryshape.shapes",
38-
});*/
48+
});
3949

4050
console.log(shapes);
4151
let modifiedShapes = shapes.map((shape, index) => {
@@ -82,7 +92,13 @@ const App = (props) => {
8292
return (
8393
<>
8494
{loading ? (
85-
<h1>Loading...</h1>
95+
<Loader
96+
style={{margin: '20% auto auto 42%'}}
97+
type="Circles"
98+
color="#eb3d86"
99+
height={300}
100+
width={300}
101+
/>
86102
) : (
87103
<ShapePallete>
88104
<ShapeCards>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"react-dom": "17.0.1",
1515
"react-hot-toast": "^2.0.0",
1616
"react-icons": "^4.2.0",
17+
"react-loader-spinner": "^4.0.0",
1718
"react-switch": "^6.0.0",
1819
"styled-components": "^5.3.0"
1920
},

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,13 @@ react-is@16.13.1, react-is@^16.7.0, react-is@^16.8.1:
16141614
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
16151615
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
16161616

1617+
react-loader-spinner@^4.0.0:
1618+
version "4.0.0"
1619+
resolved "https://registry.yarnpkg.com/react-loader-spinner/-/react-loader-spinner-4.0.0.tgz#43d9e71b0574219f64216933c28ef5faa12262f6"
1620+
integrity sha512-RU2vpEej6G4ECei0h3q6bgLU10of9Lw5O+4AwF/mtkrX5oY20Sh/AxoPJ7etbrs/7Q3u4jN5qwCwGLRKCHpk6g==
1621+
dependencies:
1622+
prop-types "^15.7.2"
1623+
16171624
react-refresh@0.8.3:
16181625
version "0.8.3"
16191626
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f"

0 commit comments

Comments
 (0)