-
Notifications
You must be signed in to change notification settings - Fork 294
Expand file tree
/
Copy pathPlusFAQ.tsx
More file actions
96 lines (92 loc) · 2.46 KB
/
PlusFAQ.tsx
File metadata and controls
96 lines (92 loc) · 2.46 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
import type { ReactElement, ReactNode } from 'react';
import React, { useId } from 'react';
import {
Typography,
TypographyColor,
TypographyTag,
TypographyType,
} from '../typography/Typography';
import { Accordion } from '../accordion';
import { anchorDefaultRel } from '../../lib/strings';
import { feedback } from '../../lib/constants';
import { plusFAQItemsApi } from './common';
import { useLogContext } from '../../contexts/LogContext';
import { LogEvent } from '../../lib/log';
interface FAQ {
question: string;
answer: ReactNode;
}
const FAQItem = ({ item }: { item: FAQ }): ReactElement => {
const { logEvent } = useLogContext();
const handleClick = () => {
logEvent({
event_name: LogEvent.ClickPlusFaq,
target_id: item.question,
});
};
return (
<div className="rounded-10 bg-surface-float px-6 py-4">
<Accordion
onClick={handleClick}
title={
<Typography
bold
color={TypographyColor.Primary}
tag={TypographyTag.Span}
>
{item.question}
</Typography>
}
>
<div className="text-text-tertiary typo-callout">{item.answer}</div>
</Accordion>
</div>
);
};
export const PlusFAQ = (): ReactElement => {
const id = useId();
const titleId = `${id}-title`;
const items = plusFAQItemsApi;
return (
<section aria-labelledby={titleId} className="my-10">
<Typography
bold
className="mb-10 text-center"
id={titleId}
tag={TypographyTag.H2}
type={TypographyType.Title3}
>
Frequently asked questions
</Typography>
<div className="mx-auto flex max-w-3xl flex-col gap-4">
{items.map((item) => (
<FAQItem key={item.question} item={item} />
))}
</div>
<Typography
className="mt-10 text-center"
color={TypographyColor.Tertiary}
type={TypographyType.Callout}
>
For technical or product related questions{' '}
<a
className="underline"
href={feedback}
target="_blank"
rel={anchorDefaultRel}
>
click here
</a>{' '}
or email us at{' '}
<a
className="underline"
href="mailto:support@daily.dev?subject=I have a question about Plus membership"
target="_blank"
rel={anchorDefaultRel}
>
support@daily.dev
</a>
</Typography>
</section>
);
};