Skip to content

Commit

Permalink
Adding PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
arangates committed Aug 5, 2020
1 parent feab58e commit 181badd
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"files.exclude": {
"**/node_modules/**": true
}
},
"css.lint.unknownAtRules": "ignore"
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

All network requests are proxied via CORS Anywhere helps with accessing data from other websites that is normally forbidden by the same origin policy of web browsers

SWR - state management
SSR - NextJS
PWA - next-pwa
recharts - Charting library
idb-keyval - IndexedDB


Demo : https://comparecart.vercel.app/
12 changes: 11 additions & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ class MyDocument extends Document {
render() {
return (
<Html lang="en">
<Head />
<Head>
<title>CompareCart</title>
<meta name='viewport' content='initial-scale=1.0, width=device-width' />
<meta name='theme-color' content='#4553F0' />
<meta
name='description'
content='The compare cart will show the difference between the sellers, rating and price.'
/>
<link rel="apple-touch-icon" href="/maskable_logo1024.png"></link>
<link rel="manifest" href="/manifest.webmanifest"></link>
</Head>
<body>
<Main />
<NextScript />
Expand Down
14 changes: 2 additions & 12 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, { useReducer, useEffect } from 'react';
import { set, get } from 'idb-keyval';
import Head from 'next/head';

import {
Loader,
SiteHeader,
SideBar,
Title,
Search,
ProductList,
Title,
Loader,
} from 'components';

import { reducer, initialState, fetchProducts } from 'services/product';
Expand Down Expand Up @@ -72,15 +71,6 @@ const IndexPage = () => {

return (
<>
<Head>
<title>CompareCart</title>
<meta name='viewport' content='initial-scale=1.0, width=device-width' />
<meta name='theme-color' content='#4553F0' />
<meta
name='description'
content='The compare cart will show the difference between the sellers, rating and price.'
/>
</Head>
<div
id='app'
className='min-h-screen bg-white-200 antialiased xl:flex xl:flex-col xl:h-screen'
Expand Down
9 changes: 8 additions & 1 deletion public/manifest.json → public/manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"short_name": "Comparecart",
"name": "Compare cart",
"description": "The compare cart will show the difference between the sellers, rating and price.",
"icons": [
{
"src": "favicon.ico",
Expand All @@ -13,12 +14,18 @@
"sizes": "192x192"
},
{
"purpose": "maskable",
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
},
{
"purpose": "maskable",
"src": "maskable_logo1024",
"type": "image/png",
"sizes": "1024x512"
}
],
"description": "The compare cart will show the difference between the sellers, rating and price.",
"lang": "en-US",
"start_url": ".",
"display": "standalone",
Expand Down
Binary file added public/maskable_logo1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/sw.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/workbox-432e0d0b.js

Large diffs are not rendered by default.

48 changes: 26 additions & 22 deletions styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@ body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
font-size: clamp(100%, 1rem + 2vw, 14px);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

.frappe-chart .x.axis text {
display: none;
}
Expand All @@ -29,38 +23,48 @@ code {
margin: 100px auto;
}

.double-bounce1, .double-bounce2 {
.double-bounce1,
.double-bounce2 {
width: 100%;
height: 100%;
border-radius: 50%;
background-color: #6A75F3;
background-color: #6a75f3;
opacity: 0.6;
position: absolute;
top: 0;
left: 0;
-webkit-animation: sk-bounce 2.0s infinite ease-in-out;
animation: sk-bounce 2.0s infinite ease-in-out;

-webkit-animation: sk-bounce 2s infinite ease-in-out;
animation: sk-bounce 2s infinite ease-in-out;
}

.double-bounce2 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
-webkit-animation-delay: -1s;
animation-delay: -1s;
}

@-webkit-keyframes sk-bounce {
0%, 100% { -webkit-transform: scale(0.0) }
50% { -webkit-transform: scale(1.0) }
0%,
100% {
-webkit-transform: scale(0);
}
50% {
-webkit-transform: scale(1);
}
}

@keyframes sk-bounce {
0%, 100% {
transform: scale(0.0);
-webkit-transform: scale(0.0);
} 50% {
transform: scale(1.0);
-webkit-transform: scale(1.0);
0%,
100% {
transform: scale(0);
-webkit-transform: scale(0);
}
50% {
transform: scale(1);
-webkit-transform: scale(1);
}
}

button:focus {outline:0;}
button:focus {
outline: 0;
}

1 comment on commit 181badd

@vercel
Copy link

@vercel vercel bot commented on 181badd Aug 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.