-
Notifications
You must be signed in to change notification settings - Fork 295
Expand file tree
/
Copy pathPlusGrid.tsx
More file actions
126 lines (116 loc) · 3.86 KB
/
PlusGrid.tsx
File metadata and controls
126 lines (116 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import React from 'react';
import {
TypographyType,
Typography,
TypographyTag,
TypographyColor,
} from '../../typography/Typography';
import { DevPlusIcon } from '../../icons';
import { Button, ButtonColor, ButtonVariant } from '../../buttons/Button';
import type { MarketingCta } from '../../marketingCta/common';
import CloseButton from '../../CloseButton';
import { useBoot } from '../../../hooks';
import { LogEvent, TargetType } from '../../../lib/log';
import { useLogContext } from '../../../contexts/LogContext';
import { PlusItemStatus, PlusListItem } from '../../plus/PlusListItem';
import { useFeature } from '../../GrowthBookProvider';
import { featurePlusApiLanding } from '../../../lib/featureManagement';
const bulletPointsControl = [
{
label: 'Advanced custom feeds',
tooltip: `Build laser-focused feeds for the tools, languages, and topics you care about. Search less, learn more.`,
status: PlusItemStatus.Ready,
},
{
label: 'Ad-free experience',
tooltip: `No ads. No clutter. Just pure content. Your feed, distraction-free.`,
status: PlusItemStatus.Ready,
},
{
label: 'Run prompts on any post',
tooltip: `Turn any post into an interactive learning experience. Ask AI to simplify concepts, challenge ideas, compare alternatives, or create your own custom prompt.`,
status: PlusItemStatus.Ready,
},
{
label: 'Bookmark folders',
tooltip: `Easily categorize and organize your bookmarked posts into folders so you can find what you need quickly.`,
status: PlusItemStatus.Ready,
},
];
const PlusGrid = ({ flags, campaignId }: MarketingCta) => {
const { logEvent } = useLogContext();
const { clearMarketingCta } = useBoot();
const isApiLanding = useFeature(featurePlusApiLanding);
if (!flags) {
return null;
}
const { title, description, ctaText, ctaUrl } = flags;
const ctaColor = isApiLanding ? ButtonColor.Bacon : ButtonColor.Avocado;
const handleClose = () => {
logEvent({
event_name: LogEvent.MarketingCtaDismiss,
target_type: TargetType.PlusEntryCard,
target_id: campaignId,
});
clearMarketingCta(campaignId);
};
const handleClick = () => {
logEvent({
event_name: LogEvent.ClickPlusFeature,
target_type: TargetType.PlusEntryCard,
target_id: campaignId,
});
clearMarketingCta(campaignId);
};
return (
<div className="plus-entry-gradient relative overflow-hidden rounded-b-16 p-4 pb-6">
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<div className="rounded-8 bg-action-plus-float p-1">
<DevPlusIcon className="fill-action-plus-default" />
</div>
<Typography
tag={TypographyTag.H3}
type={TypographyType.Title3}
bold
>
{title}
</Typography>
</div>
<CloseButton onClick={handleClose} />
</div>
<div className="flex flex-col gap-4">
<Typography
tag={TypographyTag.P}
type={TypographyType.Callout}
color={TypographyColor.Secondary}
>
{description}
</Typography>
<div className="flex w-full flex-col gap-1">
{bulletPointsControl.map((bulletPoint) => (
<PlusListItem
key={bulletPoint.label}
typographyProps={{
className: 'typo-callout',
}}
item={bulletPoint}
/>
))}
</div>
</div>
<Button
tag="a"
href={ctaUrl || '/plus'}
variant={ButtonVariant.Primary}
color={ctaColor}
onClick={handleClick}
>
{ctaText}
</Button>
</div>
</div>
);
};
export default PlusGrid;