@rileybathurst/paddle 0.0.49 → 0.0.50

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@rileybathurst/paddle",
3
3
  "private": false,
4
- "version": "0.0.49",
4
+ "version": "0.0.50",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -0,0 +1,163 @@
1
+ import React from "react";
2
+ import { Script } from "gatsby";
3
+
4
+ interface BreadcrumbsTypes {
5
+ url: string;
6
+ [key: number]: {
7
+ name: string;
8
+ item: string;
9
+ };
10
+ }[]
11
+ // I could probably pass it two arguments instead but for now
12
+ function Breadcrumbs(breadcrumbs: BreadcrumbsTypes) {
13
+
14
+ // console.log(breadcrumbs);
15
+ // console.log(Object.entries(breadcrumbs).length);
16
+ if (!Object.entries(breadcrumbs).length) return null;
17
+
18
+ // remove the breadcrumbs.url from the Object.entries
19
+ // console.log(breadcrumbs.url);
20
+ const { url, ...rest } = breadcrumbs;
21
+
22
+ // console.log(rest);
23
+
24
+ return (
25
+ <Script type="application/ld+json">
26
+ {`
27
+ {
28
+ "@context": "https://schema.org",
29
+ "@type": "BreadcrumbList",
30
+ "itemListElement": [
31
+ ${Object.entries(rest).map(([key, breadcrumb]) => {
32
+ return `{
33
+ "@type": "ListItem",
34
+ "position": ${Number.parseInt(key) + 1},
35
+ "name": "${breadcrumb.name}",
36
+ "item": "${breadcrumbs.url}/${breadcrumb.item}"
37
+ }`
38
+ })}
39
+ ]
40
+ }
41
+ `}
42
+ </Script>
43
+ );
44
+ }
45
+
46
+ type SEOtypes = {
47
+ title?: string;
48
+ description?: string;
49
+ url?: string;
50
+ image?: string;
51
+ imageAlt?: string;
52
+ breadcrumbs?: object;
53
+ children?: React.ReactNode;
54
+
55
+ strapiLocale: {
56
+ name: string;
57
+ topbar: {
58
+ topbar: string;
59
+ };
60
+ url: string;
61
+ ogImage: string;
62
+ ogimagedescription: string;
63
+ themeColor: string;
64
+ latitude: string;
65
+ longitude: string;
66
+ geoRadius: string;
67
+ phone: string;
68
+ };
69
+
70
+ strapiLocation: {
71
+ streetAddress: string;
72
+ addressLocality: string;
73
+ addressRegion: string;
74
+ postalCode: string;
75
+ opening_time: string;
76
+ closing_time: string;
77
+ paymentAccepted: string;
78
+ };
79
+ }
80
+
81
+ export const SEO = (strapiLocale, strapiLocation: SEOtypes) => {
82
+
83
+ const businessName = `${strapiLocale.name} Kayak & Paddleboard rentals and tours`;
84
+
85
+ const seo = {
86
+ title: SE0.title ? `${SE0.title} | ${businessName}` : `${businessName} | ${strapiLocale.topbar.topbar} `,
87
+ // TODO: tagline would be a better fallback description
88
+ description: SE0.description || businessName,
89
+ url: `${strapiLocale.url}${SE0.url}` || strapiLocale.url,
90
+ image: strapiLocale.ogImage || SEO.image,
91
+ imageAlt: strapiLocale.ogimagedescription || SEO.imageAlt,
92
+ breadcrumbs: SE0.breadcrumbs || null,
93
+ };
94
+
95
+ // const query = '- cash\n - credit card';
96
+ // const formatted = query.split('\n').map((item) => item.trim().replace('- ', '')).join(', ');
97
+ // console.log(formatted);
98
+
99
+ // console.log(strapiLocation.paymentAccepted);
100
+ const paymentAcceptedQuery = strapiLocation.paymentAccepted;
101
+ const paymentAcceptedFormatted = paymentAcceptedQuery.split('\n').map((payment: string) => payment.trim().replace('- ', '')).join(', ');
102
+ // console.log(paymentAcceptedFormatted);
103
+
104
+ return (
105
+ <>
106
+ <title>{seo.title}</title>
107
+ <meta name="description" content={seo.description} />
108
+
109
+ <meta property="og:type" content="website" />
110
+ <meta property="og:url" content={seo.url} />
111
+ <meta property="og:title" content={seo.title} />
112
+ <meta property="og:description" content={seo.description} />
113
+ <meta property="og:image" content={seo.image} />
114
+ <meta property="og:image:alt" content={seo.imageAlt} />
115
+ <meta name="theme-color" content={strapiLocale.themeColor} />
116
+
117
+ <Script type="application/ld+json">
118
+ {`
119
+ {
120
+ "@context": "https://schema.org/",
121
+ "@type": "LocalBusiness",
122
+ "name": "${businessName}",
123
+ "url": "${strapiLocale.url}",
124
+ "description": "${strapiLocale.name}",
125
+ "image": "${seo.image}",
126
+ "address": {
127
+ "@type": "PostalAddress",
128
+ "streetAddress": "${strapiLocation.streetAddress}",
129
+ "addressLocality": "${strapiLocation.addressLocality}",
130
+ "addressRegion": "${strapiLocation.addressRegion}",
131
+ "postalCode": "${strapiLocation.postalCode}"
132
+ },
133
+ "geo": {
134
+ "@type": "GeoCoordinates",
135
+ "latitude": "${strapiLocale.latitude}",
136
+ "longitude": "${strapiLocale.longitude}"
137
+ },
138
+ "areaServed": {
139
+ "@type": "GeoCircle",
140
+ "geoMidpoint": {
141
+ "@type": "GeoCoordinates",
142
+ "latitude": "${strapiLocale.latitude}",
143
+ "longitude": "${strapiLocale.longitude}"
144
+ },
145
+ "geoRadius": "${strapiLocale.geoRadius}"
146
+ },
147
+ "paymentAccepted": "${paymentAcceptedFormatted}",
148
+ "telephone": "${strapiLocale.phone}",
149
+ "numberOfEmployees": "10",
150
+ "openingHours": "Mo, Tu, We, Th, Fr, Sa, Su ${strapiLocation.opening_time}-${strapiLocation.closing_time}",
151
+ "priceRange": "$30-$375"
152
+ }
153
+ `}
154
+ </Script>
155
+
156
+ {/* // ? do I have anything but two levels deep? with this maybe */}
157
+ {/* this was being weird inline so i put it in a function i might not need to */}
158
+ {/* {seo?.breadcrumbs ?? */}
159
+ <Breadcrumbs breadcrumbs={seo.breadcrumbs} />
160
+ {SE0.children}
161
+ </>
162
+ );
163
+ };
package/src/index.tsx CHANGED
@@ -25,6 +25,9 @@ export * from "./PaddleTestimonials";
25
25
 
26
26
  // Pages
27
27
 
28
+ //
29
+ export * from "./PaddleSEO";
30
+
28
31
  // TODO: test
29
32
  // Types
30
33
  export * from "./types/ticket-types";
@@ -42,14 +42,14 @@ footer {
42
42
  }
43
43
 
44
44
  .pelican,
45
- .react-aria-Breadcrumbs {
45
+ .react-aria-Breadcrumbs.pelican {
46
46
  max-width: min(var(--pelican), calc(100vw - var(--denali)));
47
47
  flex-basis: var(--pelican);
48
48
  }
49
49
 
50
50
  .albatross,
51
51
  .deck,
52
- .react-aria-Breadcrumbs.albatross {
52
+ .react-aria-Breadcrumbs {
53
53
  max-width: min(var(--albatross), calc(100vw - var(--denali)));
54
54
  flex-basis: var(--albatross);
55
55
  }
@@ -165,6 +165,10 @@ header {
165
165
  margin-block-end: var(--kosciuszko);
166
166
  }
167
167
 
168
+ .zero-block-end {
169
+ margin-block-end: 0;
170
+ }
171
+
168
172
  /*------------------*/
169
173
  /* #TOP BAR */
170
174
  /*------------------*/
@@ -61,7 +61,7 @@ ol {
61
61
  }
62
62
 
63
63
  li:not(:last-child)::after {
64
- margin-inline: var(--kosciuszko);
64
+ margin-inline-start: var(--kosciuszko);
65
65
  content: ">";
66
66
  }
67
67
  }
@@ -147,6 +147,7 @@ p {
147
147
  hr {
148
148
  border: none; /* reset */
149
149
  border-bottom: 1px solid;
150
+ margin-block-end: var(--kosciuszko);
150
151
 
151
152
  @media (prefers-color-scheme: dark) {
152
153
  border-bottom: 1px solid;