@codecademy/brand 5.10.0 → 5.11.0-alpha.024e12d22.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.
@@ -1,65 +1,88 @@
1
- import { Card, FillButton, FlexBox, StrokeButton, Text, TextButton } from '@codecademy/gamut';
1
+ import { Box, Card, FillButton, FlexBox, StrokeButton, Text, TextButton } from '@codecademy/gamut';
2
2
  import { CalendarIcon, ClockIcon } from '@codecademy/gamut-icons';
3
3
  import { formatInTimeZone } from 'date-fns-tz';
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  const formatTime = (timeString, format) => {
6
6
  return formatInTimeZone(new Date(timeString), Intl.DateTimeFormat().resolvedOptions().timeZone, format);
7
7
  };
8
+ const formatDaysLeft = timeString => {
9
+ const start = new Date(timeString).getTime();
10
+ if (Number.isNaN(start)) return '';
11
+ const now = Date.now();
12
+ const dayInMs = 24 * 60 * 60 * 1000;
13
+ const daysLeft = Math.max(0, Math.ceil((start - now) / dayInMs));
14
+ if (daysLeft === 0) {
15
+ return 'today';
16
+ }
17
+ return `in ${daysLeft} day${daysLeft === 1 ? '' : 's'}`;
18
+ };
8
19
  export const CoachingSessionCard = ({
9
20
  session,
10
21
  ctas
11
22
  }) => /*#__PURE__*/_jsx(Card, {
12
23
  borderRadius: "xl",
13
24
  p: 32,
14
- height: "auto",
25
+ border: 1,
26
+ borderColor: "border-primary",
15
27
  children: /*#__PURE__*/_jsxs(FlexBox, {
16
28
  column: true,
17
- children: [/*#__PURE__*/_jsxs(Text, {
18
- mb: 12,
19
- children: [/*#__PURE__*/_jsx(Text, {
20
- fontWeight: "bold",
21
- children: session.coachOfferingCategoryName
22
- }), ' ', "coaching session with", ' ', /*#__PURE__*/_jsx(Text, {
23
- fontWeight: "bold",
24
- children: session.participantName
25
- })]
26
- }), /*#__PURE__*/_jsxs(FlexBox, {
27
- alignItems: "center",
28
- gap: 16,
29
- mb: 24,
30
- children: [/*#__PURE__*/_jsxs(FlexBox, {
31
- alignItems: "center",
32
- gap: 8,
33
- children: [/*#__PURE__*/_jsx(CalendarIcon, {
34
- size: 16
35
- }), /*#__PURE__*/_jsx(Text, {
36
- variant: "p-small",
37
- color: "text-secondary",
38
- children: new Date(session.startTime).toLocaleDateString(undefined, {
39
- weekday: 'long',
40
- month: 'long',
41
- day: 'numeric',
42
- year: 'numeric'
43
- })
29
+ justifyContent: "space-between",
30
+ height: "100%",
31
+ children: [/*#__PURE__*/_jsxs(Box, {
32
+ children: [/*#__PURE__*/_jsxs(Text, {
33
+ mb: 4,
34
+ children: [/*#__PURE__*/_jsx(Text, {
35
+ fontWeight: "bold",
36
+ children: session.coachOfferingCategoryName
37
+ }), ' ', "coaching session with", ' ', /*#__PURE__*/_jsx(Text, {
38
+ fontWeight: "bold",
39
+ children: session.participantName
40
+ }), /*#__PURE__*/_jsxs(Text, {
41
+ fontWeight: "bold",
42
+ children: [" ", formatDaysLeft(session.startTime)]
44
43
  })]
45
44
  }), /*#__PURE__*/_jsxs(FlexBox, {
46
- alignItems: "center",
47
- gap: 8,
48
- children: [/*#__PURE__*/_jsx(ClockIcon, {
49
- size: 16
50
- }), /*#__PURE__*/_jsx(Text, {
45
+ column: true,
46
+ alignItems: "flex-start",
47
+ gap: 4,
48
+ mb: 4,
49
+ children: [/*#__PURE__*/_jsxs(FlexBox, {
50
+ alignItems: "center",
51
+ gap: 4,
52
+ py: 8,
53
+ children: [/*#__PURE__*/_jsx(CalendarIcon, {
54
+ size: 16
55
+ }), /*#__PURE__*/_jsx(Text, {
56
+ variant: "p-small",
57
+ color: "text-secondary",
58
+ children: new Date(session.startTime).toLocaleDateString(undefined, {
59
+ weekday: 'long',
60
+ month: 'long',
61
+ day: 'numeric',
62
+ year: 'numeric'
63
+ })
64
+ })]
65
+ }), /*#__PURE__*/_jsxs(FlexBox, {
66
+ alignItems: "center",
67
+ gap: 4,
68
+ py: 8,
69
+ children: [/*#__PURE__*/_jsx(ClockIcon, {
70
+ size: 16
71
+ }), /*#__PURE__*/_jsx(Text, {
72
+ variant: "p-small",
73
+ color: "text-secondary",
74
+ children: `${formatTime(session.startTime, 'h:mm aa')} - ${formatTime(session.endTime, 'h:mm aa z')}`
75
+ })]
76
+ }), session.status && /*#__PURE__*/_jsxs(Text, {
51
77
  variant: "p-small",
52
- color: "text-secondary",
53
- children: `${formatTime(session.startTime, 'h:mm aa')} - ${formatTime(session.endTime, 'h:mm aa z')}`
78
+ fontWeight: "bold",
79
+ children: ["Status: ", session.status]
54
80
  })]
55
- }), session.status && /*#__PURE__*/_jsxs(Text, {
56
- variant: "p-small",
57
- fontWeight: "bold",
58
- children: ["Status: ", session.status]
59
81
  })]
60
82
  }), /*#__PURE__*/_jsx(FlexBox, {
61
83
  alignItems: "center",
62
84
  gap: 8,
85
+ flexWrap: "wrap",
63
86
  children: ctas?.map(cta => {
64
87
  const Button = cta.buttonType === 'fill' ? FillButton : cta.buttonType === 'stroke' ? StrokeButton : TextButton;
65
88
  return /*#__PURE__*/_jsx(Button, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codecademy/brand",
3
- "version": "5.10.0",
3
+ "version": "5.11.0-alpha.024e12d22.0",
4
4
  "description": "Brand component library for Codecademy",
5
5
  "license": "MIT",
6
6
  "repository": "git@github.com:codecademy-engineering/mono.git",