@rileybathurst/paddle 0.0.15 → 0.0.16
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/PaddleTime.tsx +16 -12
- package/src/stories/Ticket.tsx +6 -7
package/package.json
CHANGED
package/src/PaddleTime.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// import * as React from "react"
|
|
2
2
|
|
|
3
|
+
import { en } from "@faker-js/faker";
|
|
4
|
+
|
|
3
5
|
interface TimeTypes {
|
|
4
6
|
start?: string | null;
|
|
5
7
|
finish?: string | null;
|
|
@@ -14,8 +16,10 @@ export const PaddleTime = ({ start, finish, duration, timeframe }: TimeTypes) =>
|
|
|
14
16
|
|
|
15
17
|
if (timeframe) {
|
|
16
18
|
return {
|
|
17
|
-
key: timeframe,
|
|
18
|
-
|
|
19
|
+
// key: timeframe, cant return key its a react special prop
|
|
20
|
+
// https://react.dev/warnings/special-props
|
|
21
|
+
entry: timeframe,
|
|
22
|
+
value: 'timeframe'
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -42,10 +46,10 @@ export const PaddleTime = ({ start, finish, duration, timeframe }: TimeTypes) =>
|
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
return {
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
${finishHoursInt}${finishMinsInt > 0 ? `:${finishMinsInt}${hairSpace}` : ''}${hairSpace}${finishAmpm}`,
|
|
48
|
-
|
|
49
|
+
entry: startHours === '12' ? 'noon' : `${startHoursInt}${startMinsInt > 0 ? `:${finishMinsInt}${hairSpace}` : ''}${startAmpm}
|
|
50
|
+
-
|
|
51
|
+
${finishHours === '12' ? 'noon' : `${finishHoursInt}${finishMinsInt > 0 ? `:${finishMinsInt}${hairSpace}` : ''}${hairSpace}${finishAmpm}`}`,
|
|
52
|
+
value: "time"
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -55,19 +59,19 @@ export const PaddleTime = ({ start, finish, duration, timeframe }: TimeTypes) =>
|
|
|
55
59
|
const mins = duration % 60;
|
|
56
60
|
|
|
57
61
|
return {
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
entry: `${hours}${hairSpace}hrs ${mins > 0 ? `${mins}${hairSpace}mins` : ''} `,
|
|
63
|
+
value: "duration"
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
return {
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
entry: `${duration}${hairSpace} mins`,
|
|
69
|
+
value: "duration"
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
return {
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
entry: null,
|
|
75
|
+
value: null
|
|
72
76
|
}
|
|
73
77
|
}
|
package/src/stories/Ticket.tsx
CHANGED
|
@@ -5,21 +5,20 @@ import { Link } from 'react-aria-components';
|
|
|
5
5
|
import { faker } from '@faker-js/faker';
|
|
6
6
|
import { PaddleTime } from '../PaddleTime';
|
|
7
7
|
|
|
8
|
-
interface TicketProps {
|
|
8
|
+
/* interface TicketProps {
|
|
9
9
|
primary?: boolean;
|
|
10
10
|
onClick?: () => void;
|
|
11
|
-
}
|
|
11
|
+
} */
|
|
12
12
|
|
|
13
|
-
export const Ticket = ({
|
|
14
|
-
primary = false,
|
|
15
|
-
...props
|
|
16
|
-
}: TicketProps) => {
|
|
13
|
+
export const Ticket = () => {
|
|
17
14
|
|
|
18
15
|
const time = PaddleTime({
|
|
19
16
|
timeframe: faker.datatype.boolean() ? faker.helpers.arrayElement(['sunset', 'overnight']) : null,
|
|
20
17
|
// ? faker boolean covering both start and finish
|
|
21
18
|
start: faker.datatype.boolean() ? `${faker.number.int({ min: 1, max: 24 })}:${faker.number.int(60)}:00.000` : null,
|
|
19
|
+
// start: '12:00:00.000',
|
|
22
20
|
finish: faker.datatype.boolean() ? `${faker.number.int({ min: 1, max: 24 })}:${faker.number.int(60)}:00.000` : null,
|
|
21
|
+
// finish: '12:00:00.000',
|
|
23
22
|
duration: faker.datatype.boolean() ? faker.number.int(200) : null
|
|
24
23
|
});
|
|
25
24
|
|
|
@@ -34,7 +33,7 @@ export const Ticket = ({
|
|
|
34
33
|
</Link>
|
|
35
34
|
</h4>
|
|
36
35
|
<div className="card__specs">
|
|
37
|
-
<h4>{time.
|
|
36
|
+
<h4>{time.entry}</h4>
|
|
38
37
|
{faker.datatype.boolean() ? <h4 className="capitalize">{faker.helpers.arrayElement(['easy', 'medium', 'hard'])} <span>Fitness</span></h4> : null}
|
|
39
38
|
</div>
|
|
40
39
|
<hr />
|