@rileybathurst/paddle 0.0.103 → 0.0.105
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
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
// TODO: Season is super broken
|
|
2
|
-
|
|
3
1
|
import * as React from "react"
|
|
4
2
|
import { Link } from 'gatsby';
|
|
5
3
|
import Markdown from "react-markdown";
|
|
6
4
|
import type { LocationCardTypes } from "./types/location-card-types";
|
|
7
5
|
import HourMin from "./hour-min";
|
|
6
|
+
import Phone from "./phone";
|
|
8
7
|
|
|
9
8
|
interface SeasonTypes {
|
|
10
9
|
season_start?: string;
|
|
@@ -23,11 +22,8 @@ function Season({ name, season_start, season_end, opening_time, closing_time }:
|
|
|
23
22
|
|
|
24
23
|
if (season_start && season_end) {
|
|
25
24
|
const currentDay = new Date();
|
|
26
|
-
console.log(`currentDay ${currentDay}`);
|
|
27
25
|
const seasonStartDate = new Date(season_start);
|
|
28
|
-
console.log(`season_start ${season_start}`);
|
|
29
26
|
const seasonEndDate = new Date(season_end);
|
|
30
|
-
console.log(`season_end ${season_end}`);
|
|
31
27
|
|
|
32
28
|
if (currentDay > seasonStartDate || currentDay < seasonEndDate) {
|
|
33
29
|
return (
|
|
@@ -78,7 +74,7 @@ interface ContentTypes {
|
|
|
78
74
|
season_end?: string;
|
|
79
75
|
|
|
80
76
|
}
|
|
81
|
-
function Content({ svg, name, address, description, opening_time, closing_time, streetAddress, addressLocality, addressRegion, postalCode, commonName, season_start, season_end }: ContentTypes) {
|
|
77
|
+
function Content({ svg, name, address, description, opening_time, closing_time, streetAddress, addressLocality, addressRegion, postalCode, commonName, season_start, season_end, phone }: ContentTypes) {
|
|
82
78
|
return (
|
|
83
79
|
<>
|
|
84
80
|
<div
|
|
@@ -89,13 +85,18 @@ function Content({ svg, name, address, description, opening_time, closing_time,
|
|
|
89
85
|
<div>
|
|
90
86
|
|
|
91
87
|
{streetAddress || addressLocality || addressRegion || postalCode || commonName ? (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
<>
|
|
89
|
+
<h3 className="elbrus">{name}</h3>
|
|
90
|
+
<address>
|
|
91
|
+
{commonName ? <span>{commonName}<br /></span> : null}
|
|
92
|
+
{streetAddress ? <span>{streetAddress}<br /></span> : null}
|
|
93
|
+
{addressLocality ? <span>{addressLocality}, </span> : null}
|
|
94
|
+
{addressRegion ? <span>{addressRegion} </span> : null}
|
|
95
|
+
{postalCode ? <span>{postalCode}<br /></span> : null}
|
|
96
|
+
</address>
|
|
97
|
+
|
|
98
|
+
{name === "On Water Rental" ? <Phone phone={phone} /> : null}
|
|
99
|
+
</>
|
|
99
100
|
) :
|
|
100
101
|
|
|
101
102
|
(<>
|
|
@@ -128,14 +129,7 @@ function Content({ svg, name, address, description, opening_time, closing_time,
|
|
|
128
129
|
)
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
export function PaddleLocationCard({ svg, name, link, address, description, opening_time, closing_time, background, streetAddress, addressLocality, addressRegion, postalCode, commonName, season_start, season_end }: LocationCardTypes) {
|
|
132
|
-
|
|
133
|
-
Object.entries({ svg, name, link, address, description, opening_time, closing_time, background, streetAddress, addressLocality, addressRegion, postalCode, commonName, season_start, season_end }).map(([key, value]) => {
|
|
134
|
-
console.log(key, value);
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
console.log(`PaddleLocationCard season_start ${season_start}`);
|
|
132
|
+
export function PaddleLocationCard({ svg, name, link, address, description, opening_time, closing_time, background, streetAddress, addressLocality, addressRegion, postalCode, commonName, season_start, season_end, phone }: LocationCardTypes) {
|
|
139
133
|
|
|
140
134
|
if (link.includes('http')) {
|
|
141
135
|
return (
|
|
@@ -161,6 +155,7 @@ export function PaddleLocationCard({ svg, name, link, address, description, open
|
|
|
161
155
|
|
|
162
156
|
season_start={season_start}
|
|
163
157
|
season_end={season_end}
|
|
158
|
+
phone={phone}
|
|
164
159
|
|
|
165
160
|
/>
|
|
166
161
|
</a>
|
|
@@ -187,6 +182,8 @@ export function PaddleLocationCard({ svg, name, link, address, description, open
|
|
|
187
182
|
|
|
188
183
|
season_start={season_start}
|
|
189
184
|
season_end={season_end}
|
|
185
|
+
phone={phone}
|
|
186
|
+
|
|
190
187
|
/>
|
|
191
188
|
</Link>
|
|
192
189
|
)
|
|
@@ -6,9 +6,10 @@ interface LocationDeckTypes {
|
|
|
6
6
|
background?: string;
|
|
7
7
|
season_start?: string;
|
|
8
8
|
season_end?: string;
|
|
9
|
+
phone?: string;
|
|
9
10
|
nodes: LocationCardTypes[];
|
|
10
11
|
}
|
|
11
|
-
export function PaddleLocationDeck({ nodes, season_start, season_end, background }: LocationDeckTypes) {
|
|
12
|
+
export function PaddleLocationDeck({ nodes, season_start, season_end, phone, background }: LocationDeckTypes) {
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
15
|
<section className="location-deck">
|
|
@@ -19,6 +20,7 @@ export function PaddleLocationDeck({ nodes, season_start, season_end, background
|
|
|
19
20
|
background={background}
|
|
20
21
|
season_start={season_start}
|
|
21
22
|
season_end={season_end}
|
|
23
|
+
phone={phone}
|
|
22
24
|
/>
|
|
23
25
|
))}
|
|
24
26
|
</section>
|
package/src/phone.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
interface FormatPhoneNumberTypes {
|
|
4
|
+
phoneNumberString: number;
|
|
5
|
+
}
|
|
6
|
+
function FormatPhoneNumber({ phoneNumberString }: FormatPhoneNumberTypes) {
|
|
7
|
+
const cleaned = `${phoneNumberString}`.replace(/\D/g, '');
|
|
8
|
+
const match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
|
|
9
|
+
if (match) {
|
|
10
|
+
return `(${match[1]}) ${match[2]}-${match[3]}`;
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type PhoneTypes = {
|
|
16
|
+
phone: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Phone = ({ phone }: PhoneTypes) => {
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<a
|
|
23
|
+
href={`tel:${phone}`}
|
|
24
|
+
rel="norel norefferer"
|
|
25
|
+
className="button"
|
|
26
|
+
>
|
|
27
|
+
Phone: <FormatPhoneNumber phoneNumberString={phone} />
|
|
28
|
+
</a>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default Phone
|
package/src/styles/cards.css
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
.deck {
|
|
6
6
|
margin-block-end: var(--aconcagua);
|
|
7
|
+
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--condor), 1fr));
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
/* TODO: needs sub-grid */
|
|
@@ -77,6 +80,10 @@
|
|
|
77
80
|
margin-inline: var(--kosciuszko);
|
|
78
81
|
}
|
|
79
82
|
|
|
83
|
+
img {
|
|
84
|
+
max-width: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
80
87
|
.card__details {
|
|
81
88
|
display: flex;
|
|
82
89
|
gap: var(--vinson);
|