@rileybathurst/paddle 1.1.3 → 1.2.0
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 +1 -1
- package/src/PaddleInchesRemainder.tsx +17 -0
- package/src/PaddlePurchase.tsx +103 -0
- package/src/Purchase.tsx +0 -4
- package/src/index.tsx +1 -0
- package/src/styles/cards.css +12 -15
- package/src/styles/layout.css +0 -2
- package/src/styles/panels.css +10 -1
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
type PaddleInchesRemainderTypes = {
|
|
4
|
+
inches: number;
|
|
5
|
+
}
|
|
6
|
+
export const PaddleInchesRemainder = ({ inches }: PaddleInchesRemainderTypes) => {
|
|
7
|
+
|
|
8
|
+
const feet = Math.floor(inches / 12);
|
|
9
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder
|
|
10
|
+
const leftover = inches % 12;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
{feet}' {leftover !== 0 ? `${leftover}"` : null}
|
|
15
|
+
</>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Link } from "gatsby";
|
|
3
|
+
import { GatsbyImage } from "gatsby-plugin-image";
|
|
4
|
+
import type { GatsbyImageType } from "./types/gatsby-image-type";
|
|
5
|
+
import { PaddleInchesRemainder } from "./PaddleInchesRemainder";
|
|
6
|
+
|
|
7
|
+
// TODO: I'm not sure if this is needed or I can loop it easier
|
|
8
|
+
interface NameTypes {
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
function Name({ name }: NameTypes) {
|
|
12
|
+
return (
|
|
13
|
+
<div className="badge">
|
|
14
|
+
<h5 className="capitalize">{name}</h5>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface BadgeTypes {
|
|
20
|
+
inflatable: boolean;
|
|
21
|
+
demo: boolean;
|
|
22
|
+
discount?: number;
|
|
23
|
+
}
|
|
24
|
+
const Badges = ({ inflatable, demo, discount }: BadgeTypes) => {
|
|
25
|
+
// TODO: deal with multiple
|
|
26
|
+
if (discount) {
|
|
27
|
+
return (
|
|
28
|
+
<div className="badge">
|
|
29
|
+
<h5 className="capitalize">{discount}% off</h5>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (inflatable) {
|
|
35
|
+
return <Name name="inflatable" />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (demo) {
|
|
39
|
+
return <Name name="demo" />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type purchaseTypes = {
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
slug: string;
|
|
49
|
+
excerpt: string;
|
|
50
|
+
length: number;
|
|
51
|
+
width: number;
|
|
52
|
+
inflatable: boolean;
|
|
53
|
+
capacity: number;
|
|
54
|
+
demo: boolean;
|
|
55
|
+
discount?: number;
|
|
56
|
+
cutout: GatsbyImageType;
|
|
57
|
+
sport: {
|
|
58
|
+
slug: string;
|
|
59
|
+
};
|
|
60
|
+
brand: {
|
|
61
|
+
slug: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export const PaddlePurchase = ({ id, title, slug, excerpt, length, width, inflatable, capacity, demo, discount, cutout, sport, brand }: purchaseTypes) => {
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<article key={id} className="card">
|
|
68
|
+
<div className="card-collage">
|
|
69
|
+
{/* <TextureBackgrounds /> */}
|
|
70
|
+
<Link
|
|
71
|
+
to={`/retail/${sport.slug}/${brand.slug}/${slug}`}
|
|
72
|
+
className="image-link"
|
|
73
|
+
>
|
|
74
|
+
<GatsbyImage
|
|
75
|
+
image={cutout?.localFile?.childImageSharp?.gatsbyImageData}
|
|
76
|
+
alt={cutout?.alternativeText || `${title} by ${brand.slug}`}
|
|
77
|
+
className="cutout"
|
|
78
|
+
objectFit="contain"
|
|
79
|
+
// TODO: this has been causing some problems but keep an eye on it
|
|
80
|
+
/>
|
|
81
|
+
</Link>
|
|
82
|
+
<Badges
|
|
83
|
+
inflatable={inflatable}
|
|
84
|
+
demo={demo}
|
|
85
|
+
discount={discount}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
<h4 className="card__title">
|
|
89
|
+
<Link to={`/retail/${sport.slug}/${brand.slug}/${slug}`}>{title}</Link>
|
|
90
|
+
</h4>
|
|
91
|
+
<hr />
|
|
92
|
+
<p>{excerpt}</p>
|
|
93
|
+
<hr />
|
|
94
|
+
<div className="card__details">
|
|
95
|
+
<h4>
|
|
96
|
+
<PaddleInchesRemainder inches={length} />
|
|
97
|
+
long by {width}" wide
|
|
98
|
+
</h4>
|
|
99
|
+
<h5 className="capitalize">Capacity {capacity} lbs</h5>
|
|
100
|
+
</div>
|
|
101
|
+
</article>
|
|
102
|
+
)
|
|
103
|
+
}
|
package/src/Purchase.tsx
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
// Retail Card
|
|
2
2
|
import React from "react";
|
|
3
|
-
// import { GatsbyImage } from 'gatsby-plugin-image';
|
|
4
3
|
import { faker } from "@faker-js/faker";
|
|
5
4
|
import { Badges } from "./Badges";
|
|
6
|
-
// import { Badges } from './Badges';
|
|
7
|
-
// import { Remainder } from './Remainder';
|
|
8
|
-
// import { useRetailContext } from '../context/RetailContext';
|
|
9
5
|
import { TextureBackgrounds } from "./TextureBackgrounds";
|
|
10
6
|
|
|
11
7
|
export const Purchase = () => {
|
package/src/index.tsx
CHANGED
package/src/styles/cards.css
CHANGED
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
.purchase-collage {
|
|
31
31
|
display: grid;
|
|
32
32
|
width: 100%;
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
> * {
|
|
35
35
|
grid-row: 1;
|
|
36
36
|
grid-column: 1;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
.texture-slice {
|
|
40
40
|
width: calc(100% - var(--elbrus));
|
|
41
41
|
aspect-ratio: 16/9;
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
box-shadow: var(--penumbra);
|
|
47
47
|
border: 1px solid whitesmoke;
|
|
48
48
|
stroke: whitesmoke;
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
@media (prefers-color-scheme: dark) {
|
|
51
51
|
border-color: var(--black-metal);
|
|
52
52
|
stroke: var(--black-metal);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
.cutout {
|
|
57
57
|
object-fit: contain;
|
|
58
58
|
place-self: center;
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
aspect-ratio: 16/9;
|
|
64
64
|
width: 100%;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
svg {
|
|
68
68
|
z-index: 1; /* TODO: variable */
|
|
69
69
|
max-height: 100%; /* overwrite the default */
|
|
70
70
|
margin: calc(var(--elbrus) / 2);
|
|
71
71
|
width: calc(100% - var(--elbrus));
|
|
72
72
|
stroke: whitesmoke;
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
@media (prefers-color-scheme: dark) {
|
|
75
75
|
stroke: var(--black-metal);
|
|
76
76
|
}
|
|
@@ -93,7 +93,8 @@
|
|
|
93
93
|
line-height: var(--aconcagua);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
hr,
|
|
96
|
+
hr,
|
|
97
|
+
p {
|
|
97
98
|
margin-inline: var(--kosciuszko);
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -237,11 +238,11 @@
|
|
|
237
238
|
.ticket {
|
|
238
239
|
/* display: flex; */
|
|
239
240
|
width: 100%;
|
|
240
|
-
background-color: var(--neutral-
|
|
241
|
-
border: 1px solid
|
|
241
|
+
background-color: var(--neutral-200);
|
|
242
|
+
border: 1px solid var(--neutral-300);
|
|
242
243
|
|
|
243
244
|
@media (prefers-color-scheme: dark) {
|
|
244
|
-
background-color: var(--neutral-
|
|
245
|
+
background-color: var(--neutral-700);
|
|
245
246
|
border-color: var(--neutral-600);
|
|
246
247
|
}
|
|
247
248
|
|
|
@@ -254,10 +255,6 @@
|
|
|
254
255
|
display: block;
|
|
255
256
|
}
|
|
256
257
|
|
|
257
|
-
p {
|
|
258
|
-
margin-inline: var(--vinson);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
258
|
.ticket__header,
|
|
262
259
|
.ticket__money,
|
|
263
260
|
.ticket__specs {
|
|
@@ -290,4 +287,4 @@
|
|
|
290
287
|
color: var(--lake-200);
|
|
291
288
|
}
|
|
292
289
|
}
|
|
293
|
-
}
|
|
290
|
+
}
|
package/src/styles/layout.css
CHANGED
|
@@ -305,13 +305,11 @@ header {
|
|
|
305
305
|
transition: var(--slow);
|
|
306
306
|
display: flex;
|
|
307
307
|
justify-content: center;
|
|
308
|
-
padding-block-start: 0.25rem;
|
|
309
308
|
padding-block-start: clamp(0.25rem, 1.667vw, var(--kilimanjaro));
|
|
310
309
|
z-index: var(--emergent); /* over the small menu when it slides up */
|
|
311
310
|
position: relative;
|
|
312
311
|
|
|
313
312
|
p {
|
|
314
|
-
margin-block-end: 0.25rem;
|
|
315
313
|
margin-block-end: clamp(0.25rem, 1.667vw, var(--kilimanjaro));
|
|
316
314
|
}
|
|
317
315
|
}
|
package/src/styles/panels.css
CHANGED
|
@@ -31,9 +31,18 @@
|
|
|
31
31
|
> *:last-child {
|
|
32
32
|
margin-block-end: 0;
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
.ticket {
|
|
36
|
+
background-color: var(--neutral-100);
|
|
37
|
+
|
|
38
|
+
@media (prefers-color-scheme: dark) {
|
|
39
|
+
background-color: var(--neutral-800);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
43
|
|
|
36
|
-
.aurora
|
|
44
|
+
.aurora,
|
|
45
|
+
.react-aria-Breadcrumbs {
|
|
37
46
|
background-color: white;
|
|
38
47
|
box-shadow: 0 0 0 100vmax white;
|
|
39
48
|
clip-path: inset(0 -100vmax);
|