generated from TheMaxium69/TyroSiteFrameWork
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index1.html
260 lines (195 loc) · 7.94 KB
/
index1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>SolidServ</title>
<link href="https://solidserv.fr/assets/LogoOnglet.png" rel="shortcut icon">
<meta name="title" content="SolidServ">
<meta name="description" content="Site web de SolidServ"/>
<meta property="og:title" content="SolidServ"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="https://solidserv.fr/"/>
<meta property="og:image" content="https://tyrolium.fr/Contenu/Image/SolidServ%20Site.png"/>
<meta property="og:description" content="SolidServ L'hébergeur de confiance créé par des professionels du secteur.
Parce que vos projets méritent d'être réalisés
avec le savoir-faire des équipes de Tyrolium."/>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.0/css/all.min.css'>
<!--
CODE DU COUNTDOWN APPARTIEN A :
https://codepen.io/FlorinPop17/pen/YbpwyG
-->
</head>
<body>
<style>
@import url('https://fonts.googleapis.com/css?family=Lato');
* {
box-sizing: border-box;
}
body {
background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
min-height: 100vh;
font-family: 'Lato', sans-serif;
margin: 0;
}
h1 {
letter-spacing: 2px;
text-align: center;
text-transform: uppercase;
}
.countdown-wrapper {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
.countdown-item {
color: #111;
font-size: 40px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
line-height: 30px;
margin: 10px;
padding-top: 10px;
position: relative;
width: 100px;
height: 100px;
}
.countdown-item span {
color: #333;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
}
.countdown-svg {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
}
footer {
background-color: #222;
color: #fff;
font-size: 14px;
bottom: 0;
position: fixed;
left: 0;
right: 0;
text-align: center;
z-index: 999;
}
footer p {
margin: 10px 0;
}
footer i {
color: red;
}
footer a {
color: #3c97bf;
text-decoration: none;
}
.countdown-item:first-child{
display: none;
}
</style>
<div id="app"></div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/16.8.3/umd/react.production.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.3/umd/react-dom.production.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js'></script><script src="./script.js"></script>
<script>
function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}class Countdown extends React.Component {constructor(...args) {super(...args);_defineProperty(this, "state",
{
days: undefined,
hours: undefined,
minutes: undefined,
seconds: undefined });}
componentDidMount() {
this.interval = setInterval(() => {
const { timeTillDate, timeFormat } = this.props;
const then = moment(timeTillDate, timeFormat);
const now = moment();
const countdown = moment(then - now);
const days = countdown.format('D');
const hours = countdown.format('HH');
const minutes = countdown.format('mm');
const seconds = countdown.format('ss');
this.setState({ days, hours, minutes, seconds });
}, 1000);
}
componentWillUnmount() {
if (this.interval) {
clearInterval(this.interval);
}
}
render() {
const { days, hours, minutes, seconds } = this.state;
const daysRadius = mapNumber(days, 30, 0, 0, 360);
const hoursRadius = mapNumber(hours, 24, 0, 0, 360);
const minutesRadius = mapNumber(minutes, 60, 0, 0, 360);
const secondsRadius = mapNumber(seconds, 60, 0, 0, 360);
if (!seconds) {
return null;
}
return /*#__PURE__*/(
React.createElement("div", null, /*#__PURE__*/
React.createElement("h1", null, "COMPTE A REBOURS"), /*#__PURE__*/
React.createElement("div", { className: "countdown-wrapper" },
days && /*#__PURE__*/
React.createElement("div", { className: "countdown-item" }, /*#__PURE__*/
React.createElement(SVGCircle, { radius: daysRadius }),
days, /*#__PURE__*/
React.createElement("span", null, "days")),
hours && /*#__PURE__*/
React.createElement("div", { className: "countdown-item" }, /*#__PURE__*/
React.createElement(SVGCircle, { radius: hoursRadius }),
hours, /*#__PURE__*/
React.createElement("span", null, "hours")),
minutes && /*#__PURE__*/
React.createElement("div", { className: "countdown-item" }, /*#__PURE__*/
React.createElement(SVGCircle, { radius: minutesRadius }),
minutes, /*#__PURE__*/
React.createElement("span", null, "minutes")),
seconds && /*#__PURE__*/
React.createElement("div", { className: "countdown-item" }, /*#__PURE__*/
React.createElement(SVGCircle, { radius: secondsRadius }),
seconds, /*#__PURE__*/
React.createElement("span", null, "seconds")))));
}}
const SVGCircle = ({ radius }) => /*#__PURE__*/
React.createElement("svg", { className: "countdown-svg" }, /*#__PURE__*/
React.createElement("path", { fill: "none", stroke: "#333", "stroke-width": "4", d: describeArc(50, 50, 48, 0, radius) }));
ReactDOM.render( /*#__PURE__*/
React.createElement(Countdown, {
timeTillDate: "05 07 2022, 1:00 pm",
timeFormat: "MM DD YYYY, h:mm a" }),
document.getElementById('app'));
// From stackoverflow: https://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle
function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;
return {
x: centerX + radius * Math.cos(angleInRadians),
y: centerY + radius * Math.sin(angleInRadians) };
}
function describeArc(x, y, radius, startAngle, endAngle) {
var start = polarToCartesian(x, y, radius, endAngle);
var end = polarToCartesian(x, y, radius, startAngle);
var largeArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
var d = [
"M", start.x, start.y,
"A", radius, radius, 0, largeArcFlag, 0, end.x, end.y].
join(" ");
return d;
}
// Stackoverflow: https://stackoverflow.com/questions/10756313/javascript-jquery-map-a-range-of-numbers-to-another-range-of-numbers
function mapNumber(number, in_min, in_max, out_min, out_max) {
return (number - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
</script>
</body>
</html>