@rileybathurst/paddle 1.9.18 → 1.9.20

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": "1.9.18",
4
+ "version": "1.9.20",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "tsc --noEmit && stay-gold && vite",
@@ -54,8 +54,8 @@ export const PaddlePurchase = ({
54
54
  demo,
55
55
  discount,
56
56
  cutout,
57
- sportSlug,
58
- brandSlug,
57
+ sport,
58
+ brand,
59
59
  baseOne,
60
60
  baseTwo,
61
61
  baseThree,
@@ -76,13 +76,13 @@ export const PaddlePurchase = ({
76
76
  topThree={topThree}
77
77
  />
78
78
  <Link
79
- to={`/retail/${sportSlug}/${brandSlug}/${slug}`}
79
+ to={`/retail/${sport.slug}/${brand.slug}/${slug}`}
80
80
  className="image-link"
81
81
  >
82
82
  {cutout && (
83
83
  <GatsbyImage
84
84
  image={cutout.localFile?.childImageSharp?.gatsbyImageData}
85
- alt={cutout.alternativeText || `${title} by ${brandSlug}`}
85
+ alt={cutout.alternativeText || `${title} by ${brand.name}`}
86
86
  className="cutout"
87
87
  objectFit="contain"
88
88
  />
@@ -95,7 +95,7 @@ export const PaddlePurchase = ({
95
95
  />
96
96
  </div>
97
97
  <h4 className="purchase__title">
98
- <Link to={`/retail/${sportSlug}/${brandSlug}/${slug}`}>{title}</Link>
98
+ <Link to={`/retail/${sport.slug}/${brand.slug}/${slug}`}>{title}</Link>
99
99
  </h4>
100
100
  <hr />
101
101
  <p>{excerpt}</p>
@@ -1,12 +1,19 @@
1
1
  import * as React from "react";
2
2
  import PaddleRemainder from "./paddle-remainder";
3
3
 
4
- interface SpecsTypes {
5
- [key: string]:
6
- | string
7
- | number
4
+ /* * this is slightly complex to allow for time
5
+ const specs: SpecsTypes = {
6
+ name: "turbo", // ✅ string
7
+ power: 500, // ✅ number
8
+ dimensions: { // ✅ nested object
9
+ width: 100, // ✅ number
10
+ unit: "px", // ✅ string
11
+ }
12
+ } */
13
+ type SpecsTypes = {
14
+ [key: string]: | string | number
8
15
  | {
9
- [key: string]: string | number[];
16
+ [key: string]: string | number;
10
17
  };
11
18
  }
12
19
  // * moving the section tag to the parent component means you can loop yourself
@@ -16,9 +23,11 @@ export const PaddleSpecs = (specs: SpecsTypes) =>
16
23
  // console.log(key, value);
17
24
 
18
25
  if (!value) {
26
+ console.warn(`Missing value for ${key}`);
19
27
  return null;
20
28
  }
21
29
 
30
+ // * time is a special case as it has a nested value
22
31
  if (key === "time" && typeof value === "object") {
23
32
  return (
24
33
  <div key={key} className="spec">
@@ -30,6 +39,15 @@ export const PaddleSpecs = (specs: SpecsTypes) =>
30
39
  // * I cant remeber others yet
31
40
  }
32
41
 
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
33
51
  if (key === "cost" && typeof value === "object" && value.discount) {
34
52
  const amount = (Number(value.price) -
35
53
  Number(value.discount) * (Number(value.price) / 100)) as number;
@@ -14,10 +14,14 @@ export type PaddlePurchaseTypes = {
14
14
  cutout: PaddleGatsbyImageType;
15
15
 
16
16
  sport: {
17
+ id: React.Key;
17
18
  slug: string
19
+ title: string;
18
20
  };
19
21
  brand: {
22
+ id: React.Key;
20
23
  slug: string
24
+ name: string;
21
25
  };
22
26
 
23
27
  baseOne: { image: PaddleGatsbyImageType };