AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 1 | /*! |
| 2 | * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 13 | * or implied. See the License for the specific language governing |
| 14 | * permissions and limitations under the License. |
| 15 | */ |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 16 | import React, { Component } from 'react'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 17 | import md5 from 'md5'; |
| 18 | |
| 19 | class ImportantLogic extends Component { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 20 | state = { |
| 21 | whatToDisplay: false |
| 22 | }; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 23 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 24 | componentWillReceiveProps(nextProps) { |
| 25 | this.setState({ |
| 26 | whatToDisplay: |
| 27 | md5(nextProps.display) === 'a55899b341525123628776dbf5755d51' |
| 28 | }); |
| 29 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 30 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 31 | render() { |
| 32 | if (this.state.whatToDisplay) { |
| 33 | setTimeout(() => this.setState({ whatToDisplay: false }), 5000); |
| 34 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 35 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 36 | return ( |
| 37 | <div> |
| 38 | <style> |
| 39 | { |
| 40 | '.easter-wrapper {\ |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 41 | position: fixed;\ |
| 42 | width: 70px;\ |
| 43 | height: 70px;\ |
| 44 | }\ |
| 45 | .string, .yo-yo {\ |
| 46 | position: relative;\ |
| 47 | display: inline-block;\ |
| 48 | border-radius: 50%;\ |
| 49 | }\ |
| 50 | .string {\ |
| 51 | position: absolute;\ |
| 52 | width: 10px;\ |
| 53 | height: 10px;\ |
| 54 | top: -20px;\ |
| 55 | left: 28px;\ |
| 56 | border: 2px solid #222;\ |
| 57 | }\ |
| 58 | .string:after {\ |
| 59 | content: "";\ |
| 60 | width: 2px;\ |
| 61 | position: absolute;\ |
| 62 | top: 10px;\ |
| 63 | bottom: -50px;\ |
| 64 | left: 2px;\ |
| 65 | background: #222;\ |
| 66 | animation: string .8s infinite alternate;\ |
| 67 | }\ |
| 68 | .yo-yo {\ |
| 69 | width: 70px;\ |
| 70 | height: 70px;\ |
| 71 | background: -moz-radial-gradient(center, ellipse cover, #bcbcbc 0%, #bcbcbc 10%, #474747 11%, #474747 22%, #f47c30 22%, #f22c00 100%);\ |
| 72 | background: -webkit-radial-gradient(center, ellipse cover, #bcbcbc 0%,#bcbcbc 10%,#474747 11%,#474747 22%,#f47c30 22%,#f22c00 100%);\ |
| 73 | background: radial-gradient(ellipse at center, #bcbcbc 0%,#bcbcbc 10%,#474747 11%,#474747 22%,#f47c30 22%,#f22c00 100%); \ |
| 74 | animation: yo-yo .8s infinite alternate;\ |
| 75 | }\ |
| 76 | .yo-yo:after {\ |
| 77 | content: "";\ |
| 78 | position: abslute;\ |
| 79 | top: 49%;\ |
| 80 | right: 75%;\ |
| 81 | bottom: 49%;\ |
| 82 | left: 5%;\ |
| 83 | background: #ccc;\ |
| 84 | border-radius: 50%;\ |
| 85 | }\ |
| 86 | .yo-yo:before {\ |
| 87 | content: "";\ |
| 88 | position: absolute;\ |
| 89 | top: 49%;\ |
| 90 | right: 5%;\ |
| 91 | bottom: 49%;\ |
| 92 | left: 75%;\ |
| 93 | background: #ccc;\ |
| 94 | border-radius: 50%;\ |
| 95 | }\ |
| 96 | @keyframes string {\ |
| 97 | from { bottom: -50px}\ |
| 98 | to { bottom: -130px}\ |
| 99 | }\ |
| 100 | @keyframes yo-yo {\ |
| 101 | from { transform: rotate(-0deg); top: 0 }\ |
| 102 | to { transform: rotate(-360deg); top:120px }\ |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 103 | }' |
| 104 | } |
| 105 | </style> |
| 106 | <div |
| 107 | className="easter-wrapper" |
| 108 | style={{ |
| 109 | display: this.state.whatToDisplay ? 'block' : 'none' |
| 110 | }}> |
| 111 | <span className="string">{}</span> |
| 112 | <span className="yo-yo">{}</span> |
| 113 | </div> |
| 114 | </div> |
| 115 | ); |
| 116 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | export default ImportantLogic; |