|
1 | 1 | import { useI18n } from '@rspress/core/runtime'; |
2 | | -import { HomeFeature } from '@rspress/core/theme-original'; |
| 2 | +import { Link } from '@rspress/core/theme-original'; |
3 | 3 | import { containerStyle, innerContainerStyle } from '@rstack-dev/doc-ui/section-style'; |
4 | | -import './Features.module.scss'; |
| 4 | +import { type Feature, WhyRspack as BaseFeatures } from '@rstack-dev/doc-ui/why-rspack'; |
| 5 | +import { memo, useMemo } from 'react'; |
| 6 | +import CompatibleJson from './Features/assets/Compatible.json'; |
| 7 | +import Compatible from './Features/assets/Compatible.svg'; |
| 8 | +import FrameCheckJson from './Features/assets/FrameCheck.json'; |
| 9 | +import FrameCheck from './Features/assets/FrameCheck.svg'; |
| 10 | +import LightningJson from './Features/assets/Lightning.json'; |
| 11 | +import Lightning from './Features/assets/Lightning.svg'; |
| 12 | +import SpeedometerJson from './Features/assets/Speedometer.json'; |
| 13 | +import Speedometer from './Features/assets/Speedometer.svg'; |
| 14 | +import { useI18nUrl } from './utils'; |
5 | 15 |
|
6 | | -export function Features() { |
| 16 | +export const Features = memo(() => { |
7 | 17 | const t = useI18n<typeof import('i18n')>(); |
8 | | - const features = [ |
9 | | - { |
10 | | - title: t('unifiedCli'), |
11 | | - details: t('unifiedCliDesc'), |
12 | | - icon: '⌨️', |
13 | | - }, |
14 | | - { |
15 | | - title: t('oneConfig'), |
16 | | - details: t('oneConfigDesc'), |
17 | | - icon: '🧭', |
18 | | - }, |
19 | | - { |
20 | | - title: t('fullWorkflow'), |
21 | | - details: t('fullWorkflowDesc'), |
22 | | - icon: '🧰', |
23 | | - }, |
24 | | - { |
25 | | - title: t('ecosystemPowered'), |
26 | | - details: t('ecosystemPoweredDesc'), |
27 | | - icon: '⚡', |
28 | | - }, |
29 | | - { |
30 | | - title: t('workflowFriendly'), |
31 | | - details: t('workflowFriendlyDesc'), |
32 | | - icon: '🤝', |
33 | | - }, |
34 | | - { |
35 | | - title: t('composable'), |
36 | | - details: t('composableDesc'), |
37 | | - icon: '🧩', |
38 | | - }, |
39 | | - ]; |
| 18 | + const tUrl = useI18nUrl(); |
| 19 | + const features: Feature[] = useMemo( |
| 20 | + () => [ |
| 21 | + { |
| 22 | + img: Speedometer, |
| 23 | + url: tUrl('/guide/quick-start#cli-commands'), |
| 24 | + title: t('unifiedCli'), |
| 25 | + description: t('unifiedCliDesc'), |
| 26 | + lottieJsonData: SpeedometerJson, |
| 27 | + }, |
| 28 | + { |
| 29 | + img: Lightning, |
| 30 | + url: tUrl('/guide/configuration'), |
| 31 | + title: t('oneConfig'), |
| 32 | + description: t('oneConfigDesc'), |
| 33 | + lottieJsonData: LightningJson, |
| 34 | + }, |
| 35 | + { |
| 36 | + img: FrameCheck, |
| 37 | + url: tUrl('/guide/configuration'), |
| 38 | + title: t('ecosystemPowered'), |
| 39 | + description: t('ecosystemPoweredDesc'), |
| 40 | + lottieJsonData: FrameCheckJson, |
| 41 | + }, |
| 42 | + { |
| 43 | + img: Compatible, |
| 44 | + url: tUrl('/guide/quick-start'), |
| 45 | + title: t('workflowFriendly'), |
| 46 | + description: t('workflowFriendlyDesc'), |
| 47 | + lottieJsonData: CompatibleJson, |
| 48 | + }, |
| 49 | + ], |
| 50 | + [t, tUrl], |
| 51 | + ); |
40 | 52 |
|
41 | 53 | return ( |
42 | 54 | <section className={containerStyle}> |
43 | 55 | <div className={innerContainerStyle}> |
44 | | - <HomeFeature features={features} /> |
| 56 | + <BaseFeatures features={features} LinkComp={Link} /> |
45 | 57 | </div> |
46 | 58 | </section> |
47 | 59 | ); |
48 | | -} |
| 60 | +}); |
0 commit comments