@codecademy/brand 1.33.0-alpha.e9f120b22e.0 → 1.33.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,156 +0,0 @@
1
- import { Box, Column, FlexBox, LayoutGrid } from '@codecademy/gamut';
2
- import { Background, ColorMode } from '@codecademy/gamut-styles';
3
- import * as React from 'react';
4
- import { CTA } from './CTA';
5
- import { Description } from './Description';
6
- import { FeaturedDescription, FeaturedIcon, FeaturedImage, FeaturedStat, FeaturedTitle } from './Feature';
7
- import { Title } from './Title';
8
- import { TitleWithEyebrow } from './TitleWithEyebrow';
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- const rowRenderEach = (items, itemRenderer) => {
11
- return /*#__PURE__*/_jsx(FlexBox, {
12
- flexDirection: {
13
- _: 'column',
14
- sm: 'row'
15
- },
16
- as: "ul",
17
- pl: 0,
18
- gap: {
19
- sm: 32
20
- },
21
- children: items.map(item => /*#__PURE__*/_jsx(FlexBox, {
22
- as: "li",
23
- flex: 1,
24
- children: itemRenderer(item)
25
- }, item.title))
26
- });
27
- };
28
- const gridRenderEach = (maxCols, items, itemRenderer) => {
29
- const size = {
30
- _: 12,
31
- xs: 12 / (maxCols / 2),
32
- lg: 12 / maxCols
33
- };
34
- return /*#__PURE__*/_jsx(LayoutGrid, {
35
- gap: 32,
36
- as: "ul",
37
- pl: 0,
38
- children: items.map(item => /*#__PURE__*/_jsx(Column, {
39
- size: size,
40
- as: "li",
41
- children: itemRenderer(item)
42
- }, item.title))
43
- });
44
- };
45
- const renderEach = (maxCols, items, itemRenderer) => {
46
- if (maxCols === undefined) {
47
- return rowRenderEach(items, itemRenderer);
48
- }
49
- if (maxCols > 0 && maxCols <= 4) {
50
- return gridRenderEach(maxCols, items, itemRenderer);
51
- }
52
- return null;
53
- };
54
- export const PageFeaturesEnhanced = ({
55
- eyebrow,
56
- title,
57
- desc,
58
- cta,
59
- maxCols,
60
- features,
61
- featuresMedia,
62
- testId,
63
- onAnchorClick
64
- }) => {
65
- return /*#__PURE__*/_jsxs("div", {
66
- "data-testid": testId,
67
- children: [title && /*#__PURE__*/_jsx(FlexBox, {
68
- justifyContent: "center",
69
- textAlign: "center",
70
- children: eyebrow ? /*#__PURE__*/_jsx(TitleWithEyebrow, {
71
- title: title,
72
- eyebrow: eyebrow,
73
- isPageHeading: false,
74
- titleStyle: {
75
- fontWeight: 700,
76
- fontSize: {
77
- _: 44,
78
- sm: 44
79
- }
80
- },
81
- eyebrowStyle: {
82
- fontWeight: 'lighter',
83
- fontSize: {
84
- _: 16,
85
- sm: 16
86
- }
87
- }
88
- }) : /*#__PURE__*/_jsx(Title, {
89
- isPageHeading: false,
90
- children: title
91
- })
92
- }), desc && /*#__PURE__*/_jsx(FlexBox, {
93
- justifyContent: "center",
94
- textAlign: "center",
95
- children: /*#__PURE__*/_jsx(Description, {
96
- text: desc,
97
- onAnchorClick: onAnchorClick
98
- })
99
- }), cta && /*#__PURE__*/_jsx(Box, {
100
- mt: 32,
101
- children: /*#__PURE__*/_jsx(CTA, {
102
- href: cta.href,
103
- onClick: cta.onClick,
104
- buttonType: cta.buttonType,
105
- children: cta.text
106
- })
107
- }), /*#__PURE__*/_jsx(ColorMode, {
108
- mode: "dark",
109
- children: /*#__PURE__*/_jsx(Box, {
110
- mt: 16,
111
- children: renderEach(maxCols, features, ({
112
- testId,
113
- imgSrc,
114
- imgAlt,
115
- statText,
116
- title: featTitle,
117
- desc
118
- }) => /*#__PURE__*/_jsxs(Background, {
119
- bg: "white-300",
120
- borderRadius: "lg",
121
- py: 24,
122
- px: 16,
123
- color: "white",
124
- "data-testid": testId,
125
- children: [featuresMedia === 'image' && imgSrc && /*#__PURE__*/_jsx(FeaturedImage, {
126
- src: imgSrc,
127
- alt: imgAlt ?? ''
128
- }), featuresMedia === 'icon' && imgSrc && /*#__PURE__*/_jsx(FeaturedIcon, {
129
- src: imgSrc,
130
- alt: imgAlt ?? '',
131
- props: {
132
- mb: 16,
133
- width: '48px',
134
- height: '48px'
135
- }
136
- }), featuresMedia === 'stat' && /*#__PURE__*/_jsx(FeaturedStat, {
137
- children: statText
138
- }), featTitle && /*#__PURE__*/_jsx(FeaturedTitle, {
139
- as: desc ? title ? 'h3' : 'h2' : 'div',
140
- props: {
141
- fontSize: {
142
- _: 20,
143
- lg: 20
144
- },
145
- mb: 16
146
- },
147
- children: featTitle
148
- }), desc && /*#__PURE__*/_jsx(FeaturedDescription, {
149
- desc: desc,
150
- onAnchorClick: onAnchorClick
151
- })]
152
- }))
153
- })
154
- })]
155
- });
156
- };