@rileybathurst/paddle 0.0.104 → 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,5 +1,3 @@
|
|
|
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";
|
|
@@ -76,7 +74,7 @@ interface ContentTypes {
|
|
|
76
74
|
season_end?: string;
|
|
77
75
|
|
|
78
76
|
}
|
|
79
|
-
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) {
|
|
80
78
|
return (
|
|
81
79
|
<>
|
|
82
80
|
<div
|
|
@@ -97,7 +95,7 @@ function Content({ svg, name, address, description, opening_time, closing_time,
|
|
|
97
95
|
{postalCode ? <span>{postalCode}<br /></span> : null}
|
|
98
96
|
</address>
|
|
99
97
|
|
|
100
|
-
{name === "On Water Rental" ? <Phone /> : null}
|
|
98
|
+
{name === "On Water Rental" ? <Phone phone={phone} /> : null}
|
|
101
99
|
</>
|
|
102
100
|
) :
|
|
103
101
|
|
|
@@ -131,7 +129,7 @@ function Content({ svg, name, address, description, opening_time, closing_time,
|
|
|
131
129
|
)
|
|
132
130
|
}
|
|
133
131
|
|
|
134
|
-
export function PaddleLocationCard({ svg, name, link, address, description, opening_time, closing_time, background, streetAddress, addressLocality, addressRegion, postalCode, commonName, season_start, season_end }: LocationCardTypes) {
|
|
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) {
|
|
135
133
|
|
|
136
134
|
if (link.includes('http')) {
|
|
137
135
|
return (
|
|
@@ -157,6 +155,7 @@ export function PaddleLocationCard({ svg, name, link, address, description, open
|
|
|
157
155
|
|
|
158
156
|
season_start={season_start}
|
|
159
157
|
season_end={season_end}
|
|
158
|
+
phone={phone}
|
|
160
159
|
|
|
161
160
|
/>
|
|
162
161
|
</a>
|
|
@@ -183,6 +182,8 @@ export function PaddleLocationCard({ svg, name, link, address, description, open
|
|
|
183
182
|
|
|
184
183
|
season_start={season_start}
|
|
185
184
|
season_end={season_end}
|
|
185
|
+
phone={phone}
|
|
186
|
+
|
|
186
187
|
/>
|
|
187
188
|
</Link>
|
|
188
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
|