From f2a548f772e54e9d6dade3eb3546bcdb112a3000 Mon Sep 17 00:00:00 2001 From: avlyalin Date: Mon, 1 Jun 2020 19:57:17 +0300 Subject: [PATCH] feat: app loader component --- package-lock.json | 5 + package.json | 1 + ...y-looks-correct-prop-is-loading-1-snap.png | Bin 0 -> 11202 bytes ...rrect-prop-is-loading-with-text-1-snap.png | Bin 0 -> 10860 bytes ...-looks-correct-prop-not-loading-1-snap.png | Bin 0 -> 3249 bytes src/components/loader/index.js | 1 + src/components/loader/loader.ispec.js | 28 +++++ src/components/loader/loader.js | 34 +++++ src/components/loader/loader.stories.js | 17 +++ src/components/loader/logo.js | 119 ++++++++++++++++++ src/components/loader/logo.module.css | 53 ++++++++ src/components/loader/text.js | 23 ++++ src/containers/app/app.js | 82 +++++++----- tailwind.config.js | 1 + 14 files changed, 331 insertions(+), 33 deletions(-) create mode 100644 src/components/loader/__image_snapshots__/loader-ispec-js-loader-visually-looks-correct-prop-is-loading-1-snap.png create mode 100644 src/components/loader/__image_snapshots__/loader-ispec-js-loader-visually-looks-correct-prop-is-loading-with-text-1-snap.png create mode 100644 src/components/loader/__image_snapshots__/loader-ispec-js-loader-visually-looks-correct-prop-not-loading-1-snap.png create mode 100644 src/components/loader/index.js create mode 100644 src/components/loader/loader.ispec.js create mode 100644 src/components/loader/loader.js create mode 100644 src/components/loader/loader.stories.js create mode 100644 src/components/loader/logo.js create mode 100644 src/components/loader/logo.module.css create mode 100644 src/components/loader/text.js diff --git a/package-lock.json b/package-lock.json index d041f8f..1f8bf02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4177,6 +4177,11 @@ "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", "dev": true }, + "animate.css": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/animate.css/-/animate.css-4.1.0.tgz", + "integrity": "sha512-0aVcfWDeU9ykV6vjn1P67ZSs01jxoUQZCGaYbkk0SIIelIG8kUdLrIkua1+VabHfTtsSivDRMMn0ILPvZum2gw==" + }, "ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", diff --git a/package.json b/package.json index 4ba49ee..f5593bf 100644 --- a/package.json +++ b/package.json @@ -104,6 +104,7 @@ "@fortawesome/free-solid-svg-icons": "^5.13.0", "@fortawesome/react-fontawesome": "^0.1.9", "@hot-loader/react-dom": "^16.13.0", + "animate.css": "^4.1.0", "classnames": "^2.2.6", "core-js": "^3.6.5", "firebase": "^7.14.1", diff --git a/src/components/loader/__image_snapshots__/loader-ispec-js-loader-visually-looks-correct-prop-is-loading-1-snap.png b/src/components/loader/__image_snapshots__/loader-ispec-js-loader-visually-looks-correct-prop-is-loading-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..b1bd270935fbb8a03add061edd14e42979df8ce0 GIT binary patch literal 11202 zcmeHtXH=8f_b#G86;TlzN>x!TAVokrIEsSOYzWdKMgai{J=8?U5kX3H9EcFgC{m<~ z)X<`|NDD)6fd~OYO-M)~Atd)??)`t6_4|0&UH8MV7V9K=-#2HUy`TN;XYZA`o3<8v zcFFD%6BFBW-O~KFnAp~1Vq)TsJGX;R(n5dr2g{bA+ZLC_N(k}`Vq(X{uABdIH!OW+ z0{Lc`75$Sgv*SN-`;i*+>PMqjmDSr9%33fgzRV=?oaFSr|q*jfge^mk2oS>OKL zPk592?tyj2*ra2F%AT-y!3h~pVn^gkE@SU}C$@ZX!4}51F`&A?eU=@86gI`r%&?{F@B_GQs~nMzsFS5?l2fn9$pYVJjrAlr|_%L~jN#SKd)rG+3IU zfgwf?+FN7=olVc3_x01y!{rITJ=d@Gai|we$M+(CUP@o4nUx0F`uQfbRaMmlPu6=m zeK{sOK1NueeSWoaUrPJh0N%$9EMeU{GEgg{6B7!Ui%(y#j8|L0;c$7A2xdKDWMJT6 zMn*=NSMNthY~bVI(9q0boYI-J;KhN@cPbUdCv6mY8_fY6!iy(nrB4=T9O0WqHA}Uf zJ&PL%el=2V2aZ)7kmjA=o|ve$G~`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looks-correct-prop-is-loading-with-text-1-snap.png b/src/components/loader/__image_snapshots__/loader-ispec-js-loader-visually-looks-correct-prop-is-loading-with-text-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..10b31c0ef4299ca108b8b077ef9b2802ee1404e2 GIT binary patch literal 10860 zcmeHtXH=6}_b-Ygj*1ac5JBP$V?mmT0)h}n5mcloA{`tuh}4L*KuDsZ(m_Q)siO!; zjeztL6-bm8=_Qb0kQyKaNP)C_^4|4d>#ldr$Gg_OAN-JYo;=C(oPBor?fu*5#8_LJ zNpC-}T|z=a`tl`{>k<-@ha@C6+i%+n?xcr2ybFd+f!EE>OO$mh%}GcclDKU0=M7}$ z;&{N*7p$xa5d>y`*Yt7Bg`m`UojZ?yJ7W}18#r=xEpgvXwxx^>>Sbw_<#5*`>CuLZ zSAU6bMd9xmE|EPJG)l@d@{i4~hn?nc`bF2;jcp=k8N4js|HNr&aMR@H69+z@{PiD& z{zw`}O3#ARxz>4qdCm*jRP^quRcK#M*Z~_s_6+YV>5=SF%gk*O68E==tg57dsG3Tf zw@64_QaK0io%(tCQx89#;Ab%WM1uc&h?rbtB;g!gzmZ7TFp6@gDo25JKpPW#4QWKOH$Ot4l~N(=_9IMA{Lm$Z?ZS{u}z zdFKv7dqirz!B%fVC{04ks+u5clDkir_cL;q0mta1+1A88AHJG(OiE$xbq2+mE3b zO*40k?nz5amwOKs)y`z2dR=8T0kAv=>qbVnPg=Rtt*9mKbdqSmd=e**K5^iPl@c?6 z$m2~8V0nniE<4xD=_O-%fzz$0Mbp&Q){PArsND{7rQGfKcL|(EFf3;$4cJ%DyuJ`c zlg;6p_>R|~4ydr1Cgnh}f+6fdFt=?OT0iH^)-BIV7MF@gqn<}cm%`9GgCU%RjoL`9 zM(ZlbVHp`j^U4*ai0_ZD{rl@jt9**(pfWN}HU0@zK0`MbS>Gd$oICWV9kqw+OS>0; zrFm^dv1cIk15F?>GAd_iiB1N*`QB8HL9cPvZZzWMsy#J2_g_R3$r?VB4!1x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apshots__/loader-ispec-js-loader-visually-looks-correct-prop-not-loading-1-snap.png b/src/components/loader/__image_snapshots__/loader-ispec-js-loader-visually-looks-correct-prop-not-loading-1-snap.png new file mode 100644 index 0000000000000000000000000000000000000000..c53502031f31e98bf0d3e31e6fc1826ac7d56a65 GIT binary patch literal 3249 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-HD>;K}xM zaSW-L^Y*$SBZC6Z0fPhkpFdnAqr&y8?ED!W28M- O2?kGBKbLh*2~7ZyoZj&O literal 0 HcmV?d00001 diff --git a/src/components/loader/index.js b/src/components/loader/index.js new file mode 100644 index 0000000..0223844 --- /dev/null +++ b/src/components/loader/index.js @@ -0,0 +1 @@ +export { Loader } from './loader'; diff --git a/src/components/loader/loader.ispec.js b/src/components/loader/loader.ispec.js new file mode 100644 index 0000000..c620200 --- /dev/null +++ b/src/components/loader/loader.ispec.js @@ -0,0 +1,28 @@ +const customConfig = { + failureThreshold: 0.01, + failureThresholdType: 'percent', +}; + +describe(' visually looks correct', () => { + test('prop: is loading', async () => { + await page.goto( + 'http://localhost:9009/iframe.html?id=components-loader--common&knob-Message=&knob-Animation=false&knob-Is%20loading=true', + ); + const image = await page.screenshot(); + expect(image).toMatchImageSnapshot(customConfig); + }); + test('prop: not loading', async () => { + await page.goto( + 'http://localhost:9009/iframe.html?id=components-loader--common&knob-Message=application%20start&knob-Animation=false&knob-Is%20loading=false', + ); + const image = await page.screenshot(); + expect(image).toMatchImageSnapshot(customConfig); + }); + test('prop: is loading with text', async () => { + await page.goto( + 'http://localhost:9009/iframe.html?id=components-loader--common&knob-Message=application%20start&knob-Animation=false&knob-Is%20loading=true', + ); + const image = await page.screenshot(); + expect(image).toMatchImageSnapshot(customConfig); + }); +}); diff --git a/src/components/loader/loader.js b/src/components/loader/loader.js new file mode 100644 index 0000000..a42b108 --- /dev/null +++ b/src/components/loader/loader.js @@ -0,0 +1,34 @@ +import React from 'react'; +import classnames from 'classnames'; +import PropTypes from 'prop-types'; +import { Logo } from './logo'; +import { Text } from './text'; + +const Loader = ({ isLoading = false, animation = true, text = '' }) => { + return ( + isLoading && ( +
+ + +
+ ) + ); +}; + +Loader.propTypes = { + isLoading: PropTypes.bool.isRequired, + text: PropTypes.string, + animation: PropTypes.bool, +}; + +export { Loader }; diff --git a/src/components/loader/loader.stories.js b/src/components/loader/loader.stories.js new file mode 100644 index 0000000..1dfd5ba --- /dev/null +++ b/src/components/loader/loader.stories.js @@ -0,0 +1,17 @@ +import React from 'react'; +import { withKnobs, text, boolean } from '@storybook/addon-knobs'; +import { containerDecorator } from '_storybook/container'; +import { Loader } from './loader'; + +// eslint-disable-next-line import/no-default-export +export default { + title: 'Components/Loader', + decorators: [containerDecorator({ style: { padding: 0 } }), withKnobs], +}; + +export const Common = () => { + const isLoading = boolean('Is loading', true); + const message = text('Message', 'Запуск приложения'); + const animation = boolean('Animation', true); + return ; +}; diff --git a/src/components/loader/logo.js b/src/components/loader/logo.js new file mode 100644 index 0000000..04ef705 --- /dev/null +++ b/src/components/loader/logo.js @@ -0,0 +1,119 @@ +import React, { useEffect, useState } from 'react'; +import classnames from 'classnames'; +import PropTypes from 'prop-types'; +import styles from './logo.module.css'; + +const Logo = ({ animation = true }) => { + const [letterIndex, setLetterIndex] = useState(0); + + useEffect(() => { + const interval = setInterval(() => { + const newLetterIndex = (letterIndex + 1) % 'codenames'.length; + setLetterIndex(newLetterIndex); + }, 1500); + return () => { + clearInterval(interval); + }; + }, [letterIndex]); + + return ( +
+ + + + + + + + + +
+ ); +}; + +Logo.propTypes = { + animation: PropTypes.bool.isRequired, +}; + +const Letter = ({ letter, color, classes }) => { + return ( + + {letter} + + ); +}; + +Letter.propTypes = { + letter: PropTypes.string.isRequired, + color: PropTypes.oneOf(['blue', 'red', 'black']).isRequired, + classes: PropTypes.string, +}; + +export { Logo }; diff --git a/src/components/loader/logo.module.css b/src/components/loader/logo.module.css new file mode 100644 index 0000000..74cb07b --- /dev/null +++ b/src/components/loader/logo.module.css @@ -0,0 +1,53 @@ +@import "animate.css/source/flippers/flip.css"; + +.letter { + margin-left: 0.35rem; +} + +@responsive { + @screen xs { + .letter { + margin-left: 0.29rem; + } + } + @screen sm { + .letter { + margin-left: 0.35rem; + } + } +} + +.letter_animation_flip { + animation: flip; + animation-duration: 1.5s; +} + +.letter_animation_hinge { + transform-origin: top right; + animation: fall; + animation-duration: 1.5s; +} + +@keyframes fall { + 0% { + animation-timing-function: ease-in-out; + } + + 20%, + 60% { + transform: rotate3d(0, 0, 1, -40deg); + animation-timing-function: ease-in-out; + } + + 40%, + 80% { + transform: rotate3d(0, 0, 1, -25deg); + animation-timing-function: ease-in-out; + opacity: 1; + } + + to { + transform: translate3d(0, 300px, 0); + opacity: 0; + } +} diff --git a/src/components/loader/text.js b/src/components/loader/text.js new file mode 100644 index 0000000..14e11d2 --- /dev/null +++ b/src/components/loader/text.js @@ -0,0 +1,23 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import classnames from 'classnames'; + +const Text = ({ text = '' }) => { + return ( + text && ( + + {text} + + ) + ); +}; + +Text.propTypes = { + text: PropTypes.string.isRequired, +}; + +export { Text }; diff --git a/src/containers/app/app.js b/src/containers/app/app.js index 973c85f..af398ec 100644 --- a/src/containers/app/app.js +++ b/src/containers/app/app.js @@ -11,6 +11,7 @@ import { import { getGameSessionId } from 'src/utils/query-params'; import * as FirebaseService from 'src/service'; import { getRemainingCardsCount } from 'src/utils/team-progress'; +import { Loader } from 'src/components/loader'; import { Lobby } from '../lobby'; import { NotFound } from '../not-found'; import { ProtectedGame } from '../game'; @@ -38,6 +39,8 @@ class App extends Component { team: '', }, winnerTeam: '', + isLoading: true, + loadingText: 'Запуск приложения', }; this.sessionId = ''; } @@ -68,10 +71,15 @@ class App extends Component { )); } this.sessionId = sessionId; - this.setState({ - connected: true, - currentUser: { ...this.state.currentUser, id: userId }, - }); + this.setState( + { + connected: true, + currentUser: { ...this.state.currentUser, id: userId }, + }, + () => { + this.setState({ isLoading: false }); + }, + ); } addListeners() { @@ -162,35 +170,43 @@ class App extends Component { render() { return ( - - - - - - - - - - - + <> + {this.state.isLoading && ( + + )} + + + + + + + + + + + + ); } } diff --git a/tailwind.config.js b/tailwind.config.js index c22a1fe..517ab77 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -33,6 +33,7 @@ module.exports = { '1/4': '25%', }, screens: { + xs: '375px', sm: '568px', '2xl': '1920', },