@rileybathurst/paddle 0.0.78 → 0.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/PaddleTopBar.tsx +49 -0
- package/src/index.tsx +1 -0
- package/src/styles/layout.css +5 -3
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Markdown from 'react-markdown';
|
|
3
|
+
|
|
4
|
+
// TODO this would be nice to be able to close but I dont have it right yet
|
|
5
|
+
|
|
6
|
+
type PaddleTopBarTypes = {
|
|
7
|
+
strapiLocale: {
|
|
8
|
+
topbar: {
|
|
9
|
+
data: {
|
|
10
|
+
topbar: string;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
allStrapiWeatherDay: {
|
|
15
|
+
nodes: {
|
|
16
|
+
startDate: string;
|
|
17
|
+
startTime: string;
|
|
18
|
+
endDate: string;
|
|
19
|
+
endTime: string;
|
|
20
|
+
closed: boolean;
|
|
21
|
+
condition: {
|
|
22
|
+
excerpt: string;
|
|
23
|
+
}
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export const PaddleTopBar = ({ strapiLocale, allStrapiWeatherDay }: PaddleTopBarTypes) => {
|
|
28
|
+
|
|
29
|
+
let currentWeather = '';
|
|
30
|
+
let currentStatus = false;
|
|
31
|
+
const currentDate = new Date().toISOString().split('T')[0];
|
|
32
|
+
|
|
33
|
+
allStrapiWeatherDay.nodes.map((date) => {
|
|
34
|
+
if (date.startDate === currentDate || currentDate >= date.startDate && currentDate <= date.endDate) {
|
|
35
|
+
currentWeather = date.condition.excerpt;
|
|
36
|
+
currentStatus = date.closed;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className={`top-bar ${currentStatus ? 'closed' : 'open'}`} >
|
|
42
|
+
{currentWeather ? <p>{currentWeather}</p> :
|
|
43
|
+
<Markdown>
|
|
44
|
+
{strapiLocale.topbar.data.topbar}
|
|
45
|
+
</Markdown>
|
|
46
|
+
}
|
|
47
|
+
</div>
|
|
48
|
+
)
|
|
49
|
+
}
|
package/src/index.tsx
CHANGED
package/src/styles/layout.css
CHANGED
|
@@ -182,11 +182,8 @@ header {
|
|
|
182
182
|
/* #TOP BAR */
|
|
183
183
|
/*------------------*/
|
|
184
184
|
|
|
185
|
-
/* this flashes in on every load which is bad but its currently out of use */
|
|
186
185
|
.top-bar {
|
|
187
186
|
transition: var(--slow);
|
|
188
|
-
height: 0;
|
|
189
|
-
opacity: 0;
|
|
190
187
|
display: flex;
|
|
191
188
|
justify-content: center;
|
|
192
189
|
padding-block-start: 0.25rem;
|
|
@@ -198,6 +195,11 @@ header {
|
|
|
198
195
|
}
|
|
199
196
|
}
|
|
200
197
|
|
|
198
|
+
.top-bar.hidden {
|
|
199
|
+
height: 0;
|
|
200
|
+
opacity: 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
201
203
|
/*------------------------------------*/
|
|
202
204
|
/* #SOCIAL */
|
|
203
205
|
/*------------------------------------*/
|