@rileybathurst/paddle 1.9.19 → 1.9.21

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.19",
4
+ "version": "1.9.21",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "tsc --noEmit && stay-gold && vite",
@@ -1,12 +1,21 @@
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
+ // * number[] is for cost when passing both price and discount
14
+ // or
15
+ type SpecsTypes = {
16
+ [key: string]: | string | number
8
17
  | {
9
- [key: string]: string | number[];
18
+ [key: string]: string | number | number[];
10
19
  };
11
20
  }
12
21
  // * moving the section tag to the parent component means you can loop yourself
@@ -16,9 +25,11 @@ export const PaddleSpecs = (specs: SpecsTypes) =>
16
25
  // console.log(key, value);
17
26
 
18
27
  if (!value) {
28
+ console.warn(`Missing value for ${key}`);
19
29
  return null;
20
30
  }
21
31
 
32
+ // * time is a special case as it has a nested value
22
33
  if (key === "time" && typeof value === "object") {
23
34
  return (
24
35
  <div key={key} className="spec">
@@ -30,6 +41,15 @@ export const PaddleSpecs = (specs: SpecsTypes) =>
30
41
  // * I cant remeber others yet
31
42
  }
32
43
 
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
33
53
  if (key === "cost" && typeof value === "object" && value.discount) {
34
54
  const amount = (Number(value.price) -
35
55
  Number(value.discount) * (Number(value.price) / 100)) as number;