mirror of
https://github.com/TrentSPalmer/fcc-challenges.git
synced 2024-12-22 06:02:49 -08:00
initial version random-quote-machine
This commit is contained in:
parent
5b48f673c4
commit
5fba3f09d7
2
random-quote-machine/.gitignore
vendored
2
random-quote-machine/.gitignore
vendored
@ -9,7 +9,7 @@
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
# /build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
|
22
random-quote-machine/build/asset-manifest.json
Normal file
22
random-quote-machine/build/asset-manifest.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/css/main.899e3888.chunk.css",
|
||||
"main.js": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/main.e5d79b90.chunk.js",
|
||||
"main.js.map": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/main.e5d79b90.chunk.js.map",
|
||||
"runtime-main.js": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/runtime-main.c1bc5a42.js",
|
||||
"runtime-main.js.map": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/runtime-main.c1bc5a42.js.map",
|
||||
"static/js/2.a720d7f8.chunk.js": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/2.a720d7f8.chunk.js",
|
||||
"static/js/2.a720d7f8.chunk.js.map": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/2.a720d7f8.chunk.js.map",
|
||||
"index.html": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/index.html",
|
||||
"precache-manifest.25abb57c10a59d755367c7dec092b4ac.js": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/precache-manifest.25abb57c10a59d755367c7dec092b4ac.js",
|
||||
"service-worker.js": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/service-worker.js",
|
||||
"static/css/main.899e3888.chunk.css.map": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/css/main.899e3888.chunk.css.map",
|
||||
"static/js/2.a720d7f8.chunk.js.LICENSE.txt": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/2.a720d7f8.chunk.js.LICENSE.txt"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.c1bc5a42.js",
|
||||
"static/js/2.a720d7f8.chunk.js",
|
||||
"static/css/main.899e3888.chunk.css",
|
||||
"static/js/main.e5d79b90.chunk.js"
|
||||
]
|
||||
}
|
1
random-quote-machine/build/index.html
Normal file
1
random-quote-machine/build/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="#"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/manifest.json"/><title>Random Quote Machine - Build a Random Quote Machine - Front End Libraries Projects</title><link href="/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/css/main.899e3888.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div><script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script></div><br/></div><script>!function(e){function r(r){for(var n,a,l=r[0],i=r[1],c=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,c||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var i=t[l];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/";var l=this["webpackJsonprandom-quote-machine"]=this["webpackJsonprandom-quote-machine"]||[],i=l.push.bind(l);l.push=r,l=l.slice();for(var c=0;c<l.length;c++)r(l[c]);var f=i;t()}([])</script><script src="/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/2.a720d7f8.chunk.js"></script><script src="/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/main.e5d79b90.chunk.js"></script></body></html>
|
8
random-quote-machine/build/manifest.json
Normal file
8
random-quote-machine/build/manifest.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"short_name": "random-quote-machine",
|
||||
"name": "random-quote-machine",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||
{
|
||||
"revision": "1c58af8ab948c909dd6058ef25e70220",
|
||||
"url": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/index.html"
|
||||
},
|
||||
{
|
||||
"revision": "123251f050bd79ac6c3b",
|
||||
"url": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/css/main.899e3888.chunk.css"
|
||||
},
|
||||
{
|
||||
"revision": "d3143f0d5b138769b7fe",
|
||||
"url": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/2.a720d7f8.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "c64c486544348f10a6d6c716950bc223",
|
||||
"url": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/2.a720d7f8.chunk.js.LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"revision": "123251f050bd79ac6c3b",
|
||||
"url": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/main.e5d79b90.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "e1d0db9ba40a017fea1e",
|
||||
"url": "/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/static/js/runtime-main.c1bc5a42.js"
|
||||
}
|
||||
]);
|
3
random-quote-machine/build/robots.txt
Normal file
3
random-quote-machine/build/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
39
random-quote-machine/build/service-worker.js
Normal file
39
random-quote-machine/build/service-worker.js
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Welcome to your Workbox-powered service worker!
|
||||
*
|
||||
* You'll need to register this file in your web app and you should
|
||||
* disable HTTP caching for this file too.
|
||||
* See https://goo.gl/nhQhGp
|
||||
*
|
||||
* The rest of the code is auto-generated. Please don't update this file
|
||||
* directly; instead, make changes to your Workbox build configuration
|
||||
* and re-run your build process.
|
||||
* See https://goo.gl/2aRDsh
|
||||
*/
|
||||
|
||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||
|
||||
importScripts(
|
||||
"/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/precache-manifest.25abb57c10a59d755367c7dec092b4ac.js"
|
||||
);
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
if (event.data && event.data.type === 'SKIP_WAITING') {
|
||||
self.skipWaiting();
|
||||
}
|
||||
});
|
||||
|
||||
workbox.core.clientsClaim();
|
||||
|
||||
/**
|
||||
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
|
||||
* requests for URLs in the manifest.
|
||||
* See https://goo.gl/S9QRab
|
||||
*/
|
||||
self.__precacheManifest = [].concat(self.__precacheManifest || []);
|
||||
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
|
||||
|
||||
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/index.html"), {
|
||||
|
||||
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}.App{text-align:center}.App-header{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:calc(10px + 2vmin)}.blue-background{color:#fff}.yellow-background{color:#000}.QuoteBox{background-color:#fff;text-align:center;max-width:80%;max-height:60vh;width:500px;height:500px;border-radius:10px;box-shadow:4px 3px #000}.red-complimentary-background{background-color:#0080ff;color:#fff}.blue-complimentary-background{background-color:#7fff00;color:#fff}.yellow-complimentary-background{background-color:#8000ff;color:#000}.quote-box-top{height:70%;display:flex;flex-direction:column;justify-content:space-around}.quote-box-bottom{height:30%;display:flex;flex-direction:row;justify-content:flex-start}.quote-box-bottom-left,.quote-box-bottom-right{width:50%;display:flex;flex-direction:row;justify-content:space-around}.NewQuote{text-align:center;height:60%;width:45%;border:none;border-radius:5px;font-size:.8em;font-weight:700}.NewQuote:focus{outline:0}.TweetQuote{height:60%;width:45%;border:none;border-radius:5px;font-size:2.2em;font-weight:700;display:flex;flex-direction:column;justify-content:center;align-content:center}.tweetQuoteContainer{height:100%;width:100%;display:flex;flex-direction:row;justify-content:space-around}.TweetQuote:focus{outline:0}.red-background{background-color:red;color:#000}.blue-background{background-color:#00f;color:#ff8000}.yellow-background{background-color:#ff0;color:#0080ff}.red{color:#00ff80}.blue{color:#00f}.yellow{color:#ff0}.text{font-weight:700}.author,.text{margin-left:10%;margin-right:10%}.author{font-style:oblique}
|
||||
/*# sourceMappingURL=main.899e3888.chunk.css.map */
|
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.css","App.css","QuoteBox.css","NewQuote.css","TweetQuote.css","TextAuthor.css"],"names":[],"mappings":"AAAA,KACE,QAAS,CACT,mJAEY,CACZ,kCAAmC,CACnC,iCACF,CAEA,KACE,yEAEF,CCZA,KACE,iBACF,CAEA,YACE,gBAAiB,CACjB,YAAa,CACb,qBAAsB,CACtB,kBAAmB,CACnB,sBAAuB,CACvB,4BACF,CAOA,iBAEE,UACF,CAEA,mBAEE,UACF,CC1BA,UACE,qBAAuB,CACvB,iBAAkB,CAClB,aAAc,CACd,eAAgB,CAChB,WAAY,CACZ,YAAa,CACb,kBAAmB,CACnB,uBACF,CAEA,8BACE,wBAAyB,CACzB,UACF,CAEA,+BACE,wBAAyB,CACzB,UACF,CAEA,iCACE,wBAAyB,CACzB,UACF,CAEA,eACE,UAAW,CACX,YAAa,CACb,qBAAsB,CACtB,4BACF,CAEA,kBACE,UAAW,CACX,YAAa,CACb,kBAAmB,CACnB,0BACF,CASA,+CACE,SAAU,CACV,YAAa,CACb,kBAAmB,CACnB,4BACF,CCpDA,UACE,iBAAkB,CAClB,UAAW,CACX,SAAU,CACV,WAAY,CACZ,iBAAkB,CAClB,cAAgB,CAChB,eACF,CAEA,gBACE,SACF,CCZA,YACE,UAAW,CACX,SAAU,CACV,WAAY,CACZ,iBAAkB,CAClB,eAAgB,CAChB,eAAiB,CACjB,YAAa,CACb,qBAAsB,CACtB,sBAAuB,CACvB,oBACF,CAEA,qBACE,WAAY,CACZ,UAAW,CACX,YAAa,CACb,kBAAmB,CACnB,4BACF,CAEA,kBACE,SACF,CAEA,gBACE,oBAAyB,CACzB,UACF,CAEA,iBACE,qBAAyB,CACzB,aACF,CAEA,mBACE,qBAAyB,CACzB,aACF,CCtCA,KACE,aACF,CAEA,MACE,UACF,CAEA,QACE,UACF,CAEA,MAGE,eACF,CAEA,cALE,eAAgB,CAChB,gBAQF,CAJA,QAGE,kBACF","file":"main.899e3888.chunk.css","sourcesContent":["body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\",\n \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\",\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n}\n",".App {\n text-align: center;\n}\n\n.App-header {\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n font-size: calc(10px + 2vmin);\n}\n\n.red-background {\n background-color: #ff0000;\n color: black;\n}\n\n.blue-background {\n background-color: #0000ff;\n color: white;\n}\n\n.yellow-background {\n background-color: #ffff00;\n color: black;\n}\n",".QuoteBox {\n background-color: white;\n text-align: center;\n max-width: 80%;\n max-height: 60vh;\n width: 500px;\n height: 500px;\n border-radius: 10px;\n box-shadow: 4px 3px black;\n}\n\n.red-complimentary-background {\n background-color: #0080ff;\n color: white;\n}\n\n.blue-complimentary-background {\n background-color: #7fff00;\n color: white;\n}\n\n.yellow-complimentary-background {\n background-color: #8000ff;\n color: black;\n}\n\n.quote-box-top {\n height: 70%;\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n}\n\n.quote-box-bottom {\n height: 30%;\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n}\n\n.quote-box-bottom-left {\n width: 50%;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n}\n\n.quote-box-bottom-right {\n width: 50%;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n}\n",".NewQuote {\n text-align: center;\n height: 60%;\n width: 45%;\n border: none;\n border-radius: 5px;\n font-size: 0.8em;\n font-weight: bold;\n}\n\n.NewQuote:focus {\n outline: 0;\n}\n\n.red-background {\n background-color: #ff0000;\n color: #000000;\n}\n\n.blue-background {\n background-color: #0000ff;\n color: #ff8000;\n}\n\n.yellow-background {\n background-color: #ffff00;\n color: #0080ff;\n}\n",".TweetQuote {\n height: 60%;\n width: 45%;\n border: none;\n border-radius: 5px;\n font-size: 2.2em;\n font-weight: bold;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-content: center;\n}\n\n.tweetQuoteContainer {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n}\n\n.TweetQuote:focus {\n outline: 0;\n}\n\n.red-background {\n background-color: #ff0000;\n color: #000000;\n}\n\n.blue-background {\n background-color: #0000ff;\n color: #ff8000;\n}\n\n.yellow-background {\n background-color: #ffff00;\n color: #0080ff;\n}\n",".red {\n color: #00ff80;\n}\n\n.blue {\n color: #0000ff;\n}\n\n.yellow {\n color: #ffff00;\n}\n\n.text {\n margin-left: 10%;\n margin-right: 10%;\n font-weight: bold;\n}\n\n.author {\n margin-left: 10%;\n margin-right: 10%;\n font-style: oblique;\n}\n"]}
|
3
random-quote-machine/build/static/js/2.a720d7f8.chunk.js
Normal file
3
random-quote-machine/build/static/js/2.a720d7f8.chunk.js
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,41 @@
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/** @license React v0.19.1
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
!function(e){function r(r){for(var n,a,l=r[0],i=r[1],c=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,c||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var i=t[l];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build/";var l=this["webpackJsonprandom-quote-machine"]=this["webpackJsonprandom-quote-machine"]||[],i=l.push.bind(l);l.push=r,l=l.slice();for(var c=0;c<l.length;c++)r(l[c]);var f=i;t()}([]);
|
||||
//# sourceMappingURL=runtime-main.c1bc5a42.js.map
|
File diff suppressed because one or more lines are too long
76
random-quote-machine/package-lock.json
generated
76
random-quote-machine/package-lock.json
generated
@ -1077,6 +1077,43 @@
|
||||
"resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz",
|
||||
"integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg=="
|
||||
},
|
||||
"@fortawesome/fontawesome-common-types": {
|
||||
"version": "0.2.28",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.28.tgz",
|
||||
"integrity": "sha512-gtis2/5yLdfI6n0ia0jH7NJs5i/Z/8M/ZbQL6jXQhCthEOe5Cr5NcQPhgTvFxNOtURE03/ZqUcEskdn2M+QaBg=="
|
||||
},
|
||||
"@fortawesome/fontawesome-svg-core": {
|
||||
"version": "1.2.28",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.28.tgz",
|
||||
"integrity": "sha512-4LeaNHWvrneoU0i8b5RTOJHKx7E+y7jYejplR7uSVB34+mp3Veg7cbKk7NBCLiI4TyoWS1wh9ZdoyLJR8wSAdg==",
|
||||
"requires": {
|
||||
"@fortawesome/fontawesome-common-types": "^0.2.28"
|
||||
}
|
||||
},
|
||||
"@fortawesome/free-brands-svg-icons": {
|
||||
"version": "5.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.13.0.tgz",
|
||||
"integrity": "sha512-/6xXiJFCMEQxqxXbL0FPJpwq5Cv6MRrjsbJEmH/t5vOvB4dILDpnY0f7zZSlA8+TG7jwlt12miF/yZpZkykucA==",
|
||||
"requires": {
|
||||
"@fortawesome/fontawesome-common-types": "^0.2.28"
|
||||
}
|
||||
},
|
||||
"@fortawesome/free-solid-svg-icons": {
|
||||
"version": "5.13.0",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.13.0.tgz",
|
||||
"integrity": "sha512-IHUgDJdomv6YtG4p3zl1B5wWf9ffinHIvebqQOmV3U+3SLw4fC+LUCCgwfETkbTtjy5/Qws2VoVf6z/ETQpFpg==",
|
||||
"requires": {
|
||||
"@fortawesome/fontawesome-common-types": "^0.2.28"
|
||||
}
|
||||
},
|
||||
"@fortawesome/react-fontawesome": {
|
||||
"version": "0.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.9.tgz",
|
||||
"integrity": "sha512-49V3WNysLZU5fZ3sqSuys4nGRytsrxJktbv3vuaXkEoxv22C6T7TEG0TW6+nqVjMnkfCQd5xOnmJoZHMF78tOw==",
|
||||
"requires": {
|
||||
"prop-types": "^15.7.2"
|
||||
}
|
||||
},
|
||||
"@hapi/address": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
|
||||
@ -6063,6 +6100,14 @@
|
||||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"hoist-non-react-statics": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
|
||||
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
|
||||
"requires": {
|
||||
"react-is": "^16.7.0"
|
||||
}
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
|
||||
@ -10816,6 +10861,18 @@
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
},
|
||||
"react-redux": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.0.tgz",
|
||||
"integrity": "sha512-EvCAZYGfOLqwV7gh849xy9/pt55rJXPwmYvI4lilPM5rUT/1NxuuN59ipdBksRVSvz0KInbPnp4IfoXJXCqiDA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"loose-envify": "^1.4.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-is": "^16.9.0"
|
||||
}
|
||||
},
|
||||
"react-scripts": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-3.4.1.tgz",
|
||||
@ -10938,6 +10995,20 @@
|
||||
"strip-indent": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"redux": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz",
|
||||
"integrity": "sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==",
|
||||
"requires": {
|
||||
"loose-envify": "^1.4.0",
|
||||
"symbol-observable": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"redux-thunk": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz",
|
||||
"integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw=="
|
||||
},
|
||||
"regenerate": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
|
||||
@ -12377,6 +12448,11 @@
|
||||
"util.promisify": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"symbol-observable": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
|
||||
"integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ=="
|
||||
},
|
||||
"symbol-tree": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||
|
@ -2,14 +2,21 @@
|
||||
"name": "random-quote-machine",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"homepage":"http://192.168.1.55:3000",
|
||||
"homepage": "https://github.com/TrentSPalmer/fcc-challenges/tree/gh-pages/random-quote-machine/build",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.28",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.13.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.13.0",
|
||||
"@fortawesome/react-fontawesome": "^0.1.9",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^7.2.1",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-scripts": "3.4.1"
|
||||
"react-redux": "^7.2.0",
|
||||
"react-scripts": "3.4.1",
|
||||
"redux": "^4.0.5",
|
||||
"redux-thunk": "^2.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
@ -21,11 +28,7 @@
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"production": [">0.2%", "not dead", "not op_mini all"],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
@ -2,42 +2,22 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<link rel="icon" href="#" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
<title>
|
||||
Random Quote Machine - Build a Random Quote Machine - Front End Libraries
|
||||
Projects
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<div id="root">
|
||||
<div>
|
||||
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
@ -1,23 +1,6 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"short_name": "random-quote-machine",
|
||||
"name": "random-quote-machine",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
|
@ -2,37 +2,26 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
}
|
||||
|
||||
.red-background {
|
||||
background-color: #ff0000;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.blue-background {
|
||||
background-color: #0000ff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
.yellow-background {
|
||||
background-color: #ffff00;
|
||||
color: black;
|
||||
}
|
||||
|
@ -1,26 +1,23 @@
|
||||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
import "./App.css";
|
||||
import QuoteBox from "./QuoteBox";
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
class App extends React.Component {
|
||||
render() {
|
||||
const colors = ["red-background", "blue-background", "yellow-background"];
|
||||
const appHeaderClass = "App-header " + colors[this.props.colorCount];
|
||||
return (
|
||||
<div className="App">
|
||||
<header className={appHeaderClass}>
|
||||
<QuoteBox />
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
||||
export default connect(mapStateToProps)(App);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import App from './App';
|
||||
import React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
import App from "./App";
|
||||
|
||||
test('renders learn react link', () => {
|
||||
test("renders learn react link", () => {
|
||||
const { getByText } = render(<App />);
|
||||
const linkElement = getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
|
28
random-quote-machine/src/NewQuote.css
Normal file
28
random-quote-machine/src/NewQuote.css
Normal file
@ -0,0 +1,28 @@
|
||||
.NewQuote {
|
||||
text-align: center;
|
||||
height: 60%;
|
||||
width: 45%;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.NewQuote:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.red-background {
|
||||
background-color: #ff0000;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.blue-background {
|
||||
background-color: #0000ff;
|
||||
color: #ff8000;
|
||||
}
|
||||
|
||||
.yellow-background {
|
||||
background-color: #ffff00;
|
||||
color: #0080ff;
|
||||
}
|
44
random-quote-machine/src/NewQuote.js
Normal file
44
random-quote-machine/src/NewQuote.js
Normal file
@ -0,0 +1,44 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import "./NewQuote.css";
|
||||
|
||||
import { colorCounterAction } from "./actions/colorCounterAction";
|
||||
import { quoteFetchActionCreator } from "./actions/quoteFetchActionCreator";
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
colorCounterAction: (count) => dispatch(colorCounterAction(count)),
|
||||
quoteFetch: () => dispatch(quoteFetchActionCreator()),
|
||||
});
|
||||
|
||||
class NewQuote extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
}
|
||||
|
||||
handleClick() {
|
||||
this.props.colorCounterAction(
|
||||
this.props.colorCount > 1 ? 0 : this.props.colorCount + 1
|
||||
);
|
||||
this.props.quoteFetch();
|
||||
}
|
||||
|
||||
render() {
|
||||
const colors = ["red-background", "blue-background", "yellow-background"];
|
||||
const newQuoteClass = "NewQuote " + colors[this.props.colorCount];
|
||||
return (
|
||||
<button
|
||||
onClick={this.handleClick}
|
||||
className={newQuoteClass}
|
||||
id="new-quote"
|
||||
>
|
||||
Click Me!
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(NewQuote);
|
53
random-quote-machine/src/QuoteBox.css
Normal file
53
random-quote-machine/src/QuoteBox.css
Normal file
@ -0,0 +1,53 @@
|
||||
.QuoteBox {
|
||||
background-color: white;
|
||||
text-align: center;
|
||||
max-width: 80%;
|
||||
max-height: 60vh;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 4px 3px black;
|
||||
}
|
||||
|
||||
.red-complimentary-background {
|
||||
background-color: #0080ff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.blue-complimentary-background {
|
||||
background-color: #7fff00;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.yellow-complimentary-background {
|
||||
background-color: #8000ff;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.quote-box-top {
|
||||
height: 70%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.quote-box-bottom {
|
||||
height: 30%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.quote-box-bottom-left {
|
||||
width: 50%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.quote-box-bottom-right {
|
||||
width: 50%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
}
|
37
random-quote-machine/src/QuoteBox.js
Normal file
37
random-quote-machine/src/QuoteBox.js
Normal file
@ -0,0 +1,37 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import "./QuoteBox.css";
|
||||
import NewQuote from "./NewQuote";
|
||||
import TweetQuote from "./TweetQuote";
|
||||
import TextAuthor from "./TextAuthor";
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
class QuoteBox extends React.Component {
|
||||
render() {
|
||||
const colors = [
|
||||
"red-complimentary-background",
|
||||
"blue-complimentary-background",
|
||||
"yellow-complimentary-background",
|
||||
];
|
||||
const quoteBoxClass = "QuoteBox " + colors[this.props.colorCount];
|
||||
return (
|
||||
<div className={quoteBoxClass} id="quote-box">
|
||||
<div className="quote-box-top">
|
||||
<TextAuthor />
|
||||
</div>
|
||||
<div className="quote-box-bottom">
|
||||
<div className="quote-box-bottom-left">
|
||||
<TweetQuote />
|
||||
</div>
|
||||
<div className="quote-box-bottom-right">
|
||||
<NewQuote />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(QuoteBox);
|
23
random-quote-machine/src/TextAuthor.css
Normal file
23
random-quote-machine/src/TextAuthor.css
Normal file
@ -0,0 +1,23 @@
|
||||
.red {
|
||||
color: #00ff80;
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: #0000ff;
|
||||
}
|
||||
|
||||
.yellow {
|
||||
color: #ffff00;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 10%;
|
||||
margin-right: 10%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.author {
|
||||
margin-left: 10%;
|
||||
margin-right: 10%;
|
||||
font-style: oblique;
|
||||
}
|
42
random-quote-machine/src/TextAuthor.js
Normal file
42
random-quote-machine/src/TextAuthor.js
Normal file
@ -0,0 +1,42 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import "./TextAuthor.css";
|
||||
import { quoteFetchActionCreator } from "./actions/quoteFetchActionCreator";
|
||||
|
||||
const mapStateToProps = state => ({ ...state });
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
quoteFetch: () => dispatch(quoteFetchActionCreator())
|
||||
});
|
||||
|
||||
class TextAuthor extends React.Component {
|
||||
componentDidMount() {
|
||||
if (this.props.newQuote.quote === "") {
|
||||
this.props.quoteFetch();
|
||||
}
|
||||
}
|
||||
render() {
|
||||
let quote = "";
|
||||
let author = "";
|
||||
if (typeof this.props.newQuote.quote === "object") {
|
||||
quote = this.props.newQuote.quote.quote;
|
||||
author = this.props.newQuote.quote.author;
|
||||
}
|
||||
const colors = ["red", "blue", "yellow"];
|
||||
const textClass = "text " + colors[this.props.colorCount];
|
||||
const authorClass = "author " + colors[this.props.colorCount];
|
||||
return (
|
||||
<div style={{ fontSize: ".7em" }}>
|
||||
<p className={textClass} id="text">
|
||||
{quote}
|
||||
</p>
|
||||
<p className={authorClass} id="author">
|
||||
--{author}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(TextAuthor);
|
39
random-quote-machine/src/TweetQuote.css
Normal file
39
random-quote-machine/src/TweetQuote.css
Normal file
@ -0,0 +1,39 @@
|
||||
.TweetQuote {
|
||||
height: 60%;
|
||||
width: 45%;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 2.2em;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
.tweetQuoteContainer {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.TweetQuote:focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.red-background {
|
||||
background-color: #ff0000;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.blue-background {
|
||||
background-color: #0000ff;
|
||||
color: #ff8000;
|
||||
}
|
||||
|
||||
.yellow-background {
|
||||
background-color: #ffff00;
|
||||
color: #0080ff;
|
||||
}
|
43
random-quote-machine/src/TweetQuote.js
Normal file
43
random-quote-machine/src/TweetQuote.js
Normal file
@ -0,0 +1,43 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faTwitter } from "@fortawesome/free-brands-svg-icons";
|
||||
|
||||
import "./TweetQuote.css";
|
||||
|
||||
const mapStateToProps = state => ({ ...state });
|
||||
|
||||
class TweetQuote extends React.Component {
|
||||
render() {
|
||||
const colors = ["red-background", "blue-background", "yellow-background"];
|
||||
const tweetQuoteClass = "TweetQuote " + colors[this.props.colorCount];
|
||||
let href = "https://twitter.com/intent/tweet?text=";
|
||||
if (typeof this.props.newQuote.quote === "object") {
|
||||
href += encodeURIComponent(
|
||||
this.props.newQuote.quote.quote +
|
||||
"\n--" +
|
||||
this.props.newQuote.quote.author
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="tweetQuoteContainer">
|
||||
<div className={tweetQuoteClass}>
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
id="tweet-quote"
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon={faTwitter}
|
||||
className={colors[this.props.colorCount]}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(TweetQuote);
|
8
random-quote-machine/src/actions/colorCounterAction.js
Normal file
8
random-quote-machine/src/actions/colorCounterAction.js
Normal file
@ -0,0 +1,8 @@
|
||||
export const INCCOLORCOUNT = "INCCOLORCOUNT";
|
||||
|
||||
export const colorCounterAction = (count) => {
|
||||
return {
|
||||
type: INCCOLORCOUNT,
|
||||
count: count,
|
||||
};
|
||||
};
|
32
random-quote-machine/src/actions/quoteFetchActionCreator.js
Normal file
32
random-quote-machine/src/actions/quoteFetchActionCreator.js
Normal file
@ -0,0 +1,32 @@
|
||||
export const RECEIVED_QUOTE = "RECEIVED_QUOTE";
|
||||
export const REQUESTING_QUOTE = "REQUESTING_QUOTE";
|
||||
|
||||
export const receivedQuoteAction = quote => {
|
||||
return {
|
||||
type: RECEIVED_QUOTE,
|
||||
newQuote: quote
|
||||
};
|
||||
};
|
||||
|
||||
export const requestingQuoteAction = () => {
|
||||
return {
|
||||
type: REQUESTING_QUOTE
|
||||
};
|
||||
};
|
||||
|
||||
export const quoteFetchActionCreator = () => {
|
||||
return function (dispatch) {
|
||||
dispatch(requestingQuoteAction());
|
||||
fetch(
|
||||
"https://gist.githubusercontent.com/camperbot/5a022b72e96c4c9585c32bf6a75f62d9/raw/e3c6895ce42069f0ee7e991229064f167fe8ccdc/quotes.json"
|
||||
)
|
||||
.then(response => response.json())
|
||||
.then(quotes => {
|
||||
dispatch(
|
||||
receivedQuoteAction(
|
||||
quotes.quotes[Math.floor(Math.random() * quotes.quotes.length)]
|
||||
)
|
||||
);
|
||||
});
|
||||
};
|
||||
};
|
@ -1,13 +1,13 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||
monospace;
|
||||
}
|
||||
|
@ -1,14 +1,17 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { Provider } from "react-redux";
|
||||
import store from "./store";
|
||||
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
import * as serviceWorker from "./serviceWorker";
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
</Provider>,
|
||||
document.getElementById("root")
|
||||
);
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
|
@ -1,7 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
|
||||
<g fill="#61DAFB">
|
||||
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
|
||||
<circle cx="420.9" cy="296.5" r="45.7"/>
|
||||
<path d="M520.5 78.1z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.6 KiB |
13
random-quote-machine/src/reducers/asyncQuoteReducer.js
Normal file
13
random-quote-machine/src/reducers/asyncQuoteReducer.js
Normal file
@ -0,0 +1,13 @@
|
||||
import { REQUESTING_QUOTE } from "../actions/quoteFetchActionCreator";
|
||||
import { RECEIVED_QUOTE } from "../actions/quoteFetchActionCreator";
|
||||
|
||||
export default (state = { fetching: false, quote: "" }, action) => {
|
||||
switch (action.type) {
|
||||
case REQUESTING_QUOTE:
|
||||
return { fetching: true, quote: "" };
|
||||
case RECEIVED_QUOTE:
|
||||
return { fetching: false, quote: action.newQuote };
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
10
random-quote-machine/src/reducers/colorCounterReducer.js
Normal file
10
random-quote-machine/src/reducers/colorCounterReducer.js
Normal file
@ -0,0 +1,10 @@
|
||||
import { INCCOLORCOUNT } from "../actions/colorCounterAction";
|
||||
|
||||
export default (state = 1, action) => {
|
||||
switch (action.type) {
|
||||
case INCCOLORCOUNT:
|
||||
return action.count;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
8
random-quote-machine/src/reducers/rootReducer.js
Normal file
8
random-quote-machine/src/reducers/rootReducer.js
Normal file
@ -0,0 +1,8 @@
|
||||
import { combineReducers } from "redux";
|
||||
import colorCounterReducer from "./colorCounterReducer";
|
||||
import asyncQuoteReducer from "./asyncQuoteReducer";
|
||||
|
||||
export default combineReducers({
|
||||
colorCount: colorCounterReducer,
|
||||
newQuote: asyncQuoteReducer,
|
||||
});
|
@ -11,9 +11,9 @@
|
||||
// opt-in, read https://bit.ly/CRA-PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
window.location.hostname === "localhost" ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
window.location.hostname === "[::1]" ||
|
||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
@ -21,7 +21,7 @@ const isLocalhost = Boolean(
|
||||
);
|
||||
|
||||
export function register(config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
@ -31,7 +31,7 @@ export function register(config) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
window.addEventListener("load", () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
@ -42,8 +42,8 @@ export function register(config) {
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
"This web app is being served cache-first by a service " +
|
||||
"worker. To learn more, visit https://bit.ly/CRA-PWA"
|
||||
);
|
||||
});
|
||||
} else {
|
||||
@ -57,21 +57,21 @@ export function register(config) {
|
||||
function registerValidSW(swUrl, config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then(registration => {
|
||||
.then((registration) => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
if (installingWorker == null) {
|
||||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (installingWorker.state === "installed") {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
"New content is available and will be used when all " +
|
||||
"tabs for this page are closed. See https://bit.ly/CRA-PWA."
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
@ -82,7 +82,7 @@ function registerValidSW(swUrl, config) {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
console.log("Content is cached for offline use.");
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
@ -93,25 +93,25 @@ function registerValidSW(swUrl, config) {
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
.catch((error) => {
|
||||
console.error("Error during service worker registration:", error);
|
||||
});
|
||||
}
|
||||
|
||||
function checkValidServiceWorker(swUrl, config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl, {
|
||||
headers: { 'Service-Worker': 'script' },
|
||||
headers: { "Service-Worker": "script" },
|
||||
})
|
||||
.then(response => {
|
||||
.then((response) => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
(contentType != null && contentType.indexOf("javascript") === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
navigator.serviceWorker.ready.then((registration) => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
@ -123,18 +123,18 @@ function checkValidServiceWorker(swUrl, config) {
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
"No internet connection found. App is running in offline mode."
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.ready
|
||||
.then(registration => {
|
||||
.then((registration) => {
|
||||
registration.unregister();
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
console.error(error.message);
|
||||
});
|
||||
}
|
||||
|
@ -2,4 +2,4 @@
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
|
7
random-quote-machine/src/store.js
Normal file
7
random-quote-machine/src/store.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { createStore, applyMiddleware } from "redux";
|
||||
import thunk from "redux-thunk";
|
||||
import rootReducer from "./reducers/rootReducer";
|
||||
|
||||
const store = createStore(rootReducer, applyMiddleware(thunk));
|
||||
|
||||
export default store;
|
Loading…
Reference in New Issue
Block a user