Skip to content

Commit 277a9b5

Browse files
authored
Merge pull request #97 from FilOzone/UXIT-3662/tw-prose
Enhance Faq component with dark mode support and layout constraints
2 parents 3681842 + 7f5718d commit 277a9b5

File tree

5 files changed

+75
-35
lines changed

5 files changed

+75
-35
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"format": "biome format --write ."
1212
},
1313
"dependencies": {
14-
"@filecoin-foundation/ui-filecoin": "^0.1.11",
14+
"@filecoin-foundation/ui-filecoin": "^0.1.12",
1515
"@filoz/synapse-sdk": "^0.35.3",
1616
"@headlessui/react": "^2.2.9",
1717
"@phosphor-icons/react": "^2.1.10",

src/app/hidden/(homepage)/data/faqs.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Question } from '@/components/Faq'
2+
import { MarkdownLink } from '@/components/TextLink/MarkdownLink'
23

34
import { FOC_URLS } from '@/constants/site-metadata'
45

@@ -9,9 +10,9 @@ export const faqs: Array<Question> = [
910
<>
1011
<p>
1112
Start with the{' '}
12-
<a href={FOC_URLS.warmStorageService.synapseSdk}>
13+
<MarkdownLink href={FOC_URLS.warmStorageService.synapseSdk}>
1314
Filecoin Synapse SDK
14-
</a>{' '}
15+
</MarkdownLink>{' '}
1516
to access Filecoin Onchain Cloud flagship services. Upload, retrieve,
1617
and verify files in just a few lines of code, test everything on
1718
calibration, then switch to mainnet by pointing your SDK to the
@@ -102,14 +103,22 @@ export const faqs: Array<Question> = [
102103
</li>
103104
<li>
104105
<strong>Transparent rankings:</strong>{' '}
105-
<a href="https://dealbot-ga.fwss.io/">Storage</a> and{' '}
106-
<a href="https://github.com/filbeam/bot">retrieval</a> deal checkers
107-
continuously test retrievals across the network, executing real
108-
deals with providers to track latency, success rates, and
109-
throughput.{' '}
110-
<a href="https://dashboard.filbeam.com/">Public dashboards</a> ranks
111-
providers by performance, giving builders transparent benchmarks and
112-
helping the retrieval market' stay competitive and accountable.
106+
<MarkdownLink href="https://dealbot-ga.fwss.io/">
107+
Storage
108+
</MarkdownLink>{' '}
109+
and{' '}
110+
<MarkdownLink href="https://github.com/filbeam/bot">
111+
retrieval
112+
</MarkdownLink>{' '}
113+
deal checkers continuously test retrievals across the network,
114+
executing real deals with providers to track latency, success rates,
115+
and throughput.{' '}
116+
<MarkdownLink href="https://dashboard.filbeam.com/">
117+
Public dashboards
118+
</MarkdownLink>{' '}
119+
ranks providers by performance, giving builders transparent
120+
benchmarks and helping the retrieval market' stay competitive and
121+
accountable.
113122
</li>
114123
</ul>
115124
</>
@@ -149,16 +158,16 @@ export const faqs: Array<Question> = [
149158
<ul>
150159
<li>
151160
Join the{' '}
152-
<a href={FOC_URLS.social.telegram}>
161+
<MarkdownLink href={FOC_URLS.social.telegram}>
153162
FOC Builders group on Telegram
154-
</a>{' '}
163+
</MarkdownLink>{' '}
155164
to ask questions and get support.
156165
</li>
157166
<li>
158167
Jump into the{' '}
159-
<a href={FOC_URLS.social.slack}>
168+
<MarkdownLink href={FOC_URLS.social.slack}>
160169
#FIL-FOC channel on Filecoin Slack
161-
</a>
170+
</MarkdownLink>
162171
.
163172
</li>
164173
<li>

src/components/Faq.tsx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
'use client'
2+
3+
import { useBackgroundVariant } from '@filecoin-foundation/ui-filecoin/Section/Section'
14
import { SectionContent } from '@filecoin-foundation/ui-filecoin/SectionContent'
5+
import { clsx } from 'clsx'
26

37
import { Accordion } from './Accordion'
48

@@ -12,22 +16,28 @@ type FaqProps = {
1216
}
1317

1418
export function Faq({ questions }: FaqProps) {
19+
const backgroundVariant = useBackgroundVariant()
20+
const isDark =
21+
backgroundVariant === 'dark' || backgroundVariant === 'transparentDark'
22+
1523
return (
16-
<SectionContent title="Frequently asked questions">
17-
<Accordion
18-
type="single"
19-
collapsible
20-
className="divide-y divide-white/20 prose-invert"
21-
>
22-
{questions.map(({ question, answer }) => {
23-
return (
24-
<Accordion.Item key={question} value={question} className="py-4">
25-
<Accordion.Trigger>{question}</Accordion.Trigger>
26-
<Accordion.Content>{answer}</Accordion.Content>
27-
</Accordion.Item>
28-
)
29-
})}
30-
</Accordion>
31-
</SectionContent>
24+
<div className="max-w-4xl">
25+
<SectionContent title="Frequently asked questions">
26+
<Accordion type="single" collapsible className="divide-white/20">
27+
{questions.map(({ question, answer }) => {
28+
return (
29+
<Accordion.Item key={question} value={question} className="py-4">
30+
<Accordion.Trigger>{question}</Accordion.Trigger>
31+
<Accordion.Content
32+
className={clsx('prose max-w-none', isDark && 'prose-invert')}
33+
>
34+
{answer}
35+
</Accordion.Content>
36+
</Accordion.Item>
37+
)
38+
})}
39+
</Accordion>
40+
</SectionContent>
41+
</div>
3242
)
3343
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { MarkdownLink as SharedMarkdownLink } from '@filecoin-foundation/ui-filecoin/Markdown/MarkdownLink'
2+
import type { SmartTextLinkProps } from '@filecoin-foundation/ui-filecoin/TextLink/SmartTextLink'
3+
import Link from 'next/link'
4+
5+
import { BASE_DOMAIN } from '@/constants/site-metadata'
6+
7+
type MarkdownLinkProps = Omit<
8+
SmartTextLinkProps,
9+
'baseDomain' | 'InternalLinkComponent'
10+
>
11+
12+
export function MarkdownLink(props: MarkdownLinkProps) {
13+
return (
14+
<SharedMarkdownLink
15+
{...props}
16+
baseDomain={BASE_DOMAIN}
17+
// @ts-expect-error: Types of property 'href' are incompatible: string vs RouteImpl | UrlObject
18+
InternalLinkComponent={Link}
19+
/>
20+
)
21+
}

0 commit comments

Comments
 (0)