@rileybathurst/paddle 1.2.0 → 1.2.2

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.2.0",
4
+ "version": "1.2.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -3,6 +3,7 @@ import { Link } from "gatsby";
3
3
  import { GatsbyImage } from "gatsby-plugin-image";
4
4
  import type { GatsbyImageType } from "./types/gatsby-image-type";
5
5
  import { PaddleInchesRemainder } from "./PaddleInchesRemainder";
6
+ import { PaddleTextureBackgrounds } from "./PaddleTextureBackgrounds";
6
7
 
7
8
  // TODO: I'm not sure if this is needed or I can loop it easier
8
9
  interface NameTypes {
@@ -54,26 +55,36 @@ type purchaseTypes = {
54
55
  demo: boolean;
55
56
  discount?: number;
56
57
  cutout: GatsbyImageType;
57
- sport: {
58
- slug: string;
59
- };
60
- brand: {
61
- slug: string;
62
- };
58
+ sportSlug: string;
59
+ brandSlug: string;
60
+ baseOne: { image: GatsbyImageType };
61
+ baseTwo: { image: GatsbyImageType };
62
+ baseThree: { image: GatsbyImageType };
63
+ topOne: { image: GatsbyImageType };
64
+ topTwo: { image: GatsbyImageType };
65
+ topThree: { image: GatsbyImageType };
63
66
  };
64
- export const PaddlePurchase = ({ id, title, slug, excerpt, length, width, inflatable, capacity, demo, discount, cutout, sport, brand }: purchaseTypes) => {
67
+ export const PaddlePurchase = ({ id, title, slug, excerpt, length, width, inflatable, capacity, demo, discount, cutout, sportSlug, brandSlug, baseOne, baseTwo, baseThree, topOne, topTwo, topThree }: purchaseTypes) => {
65
68
 
66
69
  return (
67
70
  <article key={id} className="card">
68
71
  <div className="card-collage">
69
- {/* <TextureBackgrounds /> */}
72
+
73
+ <PaddleTextureBackgrounds
74
+ baseOne={baseOne}
75
+ baseTwo={baseTwo}
76
+ baseThree={baseThree}
77
+ topOne={topOne}
78
+ topTwo={topTwo}
79
+ topThree={topThree}
80
+ />
70
81
  <Link
71
- to={`/retail/${sport.slug}/${brand.slug}/${slug}`}
82
+ to={`/retail/${sportSlug}/${brandSlug}/${slug}`}
72
83
  className="image-link"
73
84
  >
74
85
  <GatsbyImage
75
- image={cutout?.localFile?.childImageSharp?.gatsbyImageData}
76
- alt={cutout?.alternativeText || `${title} by ${brand.slug}`}
86
+ image={cutout.localFile?.childImageSharp?.gatsbyImageData}
87
+ alt={cutout.alternativeText || `${title} by ${brandSlug}`}
77
88
  className="cutout"
78
89
  objectFit="contain"
79
90
  // TODO: this has been causing some problems but keep an eye on it
@@ -86,7 +97,7 @@ export const PaddlePurchase = ({ id, title, slug, excerpt, length, width, inflat
86
97
  />
87
98
  </div>
88
99
  <h4 className="card__title">
89
- <Link to={`/retail/${sport.slug}/${brand.slug}/${slug}`}>{title}</Link>
100
+ <Link to={`/retail/${sportSlug}/${brandSlug}/${slug}`}>{title}</Link>
90
101
  </h4>
91
102
  <hr />
92
103
  <p>{excerpt}</p>
@@ -0,0 +1,58 @@
1
+ import * as React from "react";
2
+ import { GatsbyImage } from "gatsby-plugin-image";
3
+ import type { GatsbyImageType } from "./types/gatsby-image-type";
4
+
5
+ type textureTypes = {
6
+ baseOne: { image: GatsbyImageType };
7
+ baseTwo: { image: GatsbyImageType };
8
+ baseThree: { image: GatsbyImageType };
9
+ topOne: { image: GatsbyImageType };
10
+ topTwo: { image: GatsbyImageType };
11
+ topThree: { image: GatsbyImageType };
12
+ };
13
+ export const PaddleTextureBackgrounds = ({ baseOne, baseTwo, baseThree, topOne, topTwo, topThree }: textureTypes) => {
14
+
15
+ const baseTextures = [
16
+ baseOne,
17
+ baseTwo,
18
+ baseThree
19
+ ];
20
+ const baseRandom = Math.floor(Math.random() * baseTextures.length);
21
+ // console.log(baseTextures[baseRandom]);
22
+
23
+ const topTextures = [
24
+ topOne,
25
+ topTwo,
26
+ topThree
27
+ ];
28
+ const topRandom = Math.floor(Math.random() * topTextures.length);
29
+ // { topTextures[topRandom] }
30
+
31
+ return (
32
+ <>
33
+ <GatsbyImage
34
+ image={baseTextures[baseRandom].image.localFile.childImageSharp.gatsbyImageData}
35
+ alt="splash texture"
36
+ className="texture-slice"
37
+ objectFit="contain"
38
+ />
39
+ <GatsbyImage
40
+ image={topTextures[topRandom].image.localFile.childImageSharp.gatsbyImageData}
41
+ alt="sand texture"
42
+ className="texture-slice crop"
43
+ objectFit="contain"
44
+ />
45
+ <svg viewBox="0 0 1200 630" xmlns="http://www.w3.org/2000/svg">
46
+ <title>Diagonal line decoration</title>
47
+ <line
48
+ x1="0"
49
+ y1="630"
50
+ x2="1200"
51
+ y2="0"
52
+ // only color the stroke in css so it has dark mode
53
+ strokeWidth="3"
54
+ />
55
+ </svg>
56
+ </>
57
+ );
58
+ };