Skip to content

Commit 9629575

Browse files
0618zhamujun
andauthored
chore(docs): use frameworks constants (#1949)
Co-authored-by: MJ☔ <[email protected]>
1 parent a41ecfb commit 9629575

File tree

2 files changed

+27
-76
lines changed

2 files changed

+27
-76
lines changed

docs/src/components/Layout/FrameworkChooser.tsx

Lines changed: 18 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from '@aws-amplify/ui-react';
77

88
import { useCustomRouter } from '@/components/useCustomRouter';
9+
import { FRAMEWORKS } from '@/data/frameworks';
910

1011
export const FrameworkChooser = ({ platform }) => {
1112
const { replace, pathname } = useCustomRouter();
@@ -43,62 +44,23 @@ export const FrameworkChooser = ({ platform }) => {
4344
isExclusive
4445
isSelectionRequired
4546
>
46-
<ToggleButton
47-
value="react"
48-
size="small"
49-
title="React"
50-
padding={{ base: '4px', medium: undefined }}
51-
>
52-
<VisuallyHidden>React</VisuallyHidden>
53-
<Image
54-
alt=""
55-
height={{ base: '1.5rem', medium: '1rem' }}
56-
display="block"
57-
src="/svg/integrations/react.svg"
58-
/>
59-
</ToggleButton>
60-
<ToggleButton
61-
value="angular"
62-
size="small"
63-
title="Angular"
64-
padding={{ base: '4px', medium: undefined }}
65-
>
66-
<VisuallyHidden>Angular</VisuallyHidden>
67-
<Image
68-
alt=""
69-
height={{ base: '1.5rem', medium: '1rem' }}
70-
display="block"
71-
src="/svg/integrations/angular.svg"
72-
/>
73-
</ToggleButton>
74-
<ToggleButton
75-
value="vue"
76-
size="small"
77-
title="Vue"
78-
padding={{ base: '4px', medium: undefined }}
79-
>
80-
<VisuallyHidden>Vue</VisuallyHidden>
81-
<Image
82-
alt=""
83-
height={{ base: '1.5rem', medium: '1rem' }}
84-
display="block"
85-
src="/svg/integrations/vue.svg"
86-
/>
87-
</ToggleButton>
88-
<ToggleButton
89-
value="flutter"
90-
size="small"
91-
title="Flutter"
92-
padding={{ base: '4px', medium: undefined }}
93-
>
94-
<VisuallyHidden>Flutter</VisuallyHidden>
95-
<Image
96-
alt=""
97-
height={{ base: '1.5rem', medium: '1rem' }}
98-
display="block"
99-
src="/svg/integrations/flutter.svg"
100-
/>
101-
</ToggleButton>
47+
{FRAMEWORKS.map((framework) => (
48+
<ToggleButton
49+
key={framework}
50+
value={framework}
51+
size="small"
52+
title={framework}
53+
padding={{ base: '4px', medium: undefined }}
54+
>
55+
<VisuallyHidden>{framework}</VisuallyHidden>
56+
<Image
57+
alt=""
58+
height={{ base: '1.5rem', medium: '1rem' }}
59+
display="block"
60+
src={`/svg/integrations/${framework}.svg`}
61+
/>
62+
</ToggleButton>
63+
))}
10264
</ToggleButtonGroup>
10365
);
10466
};

docs/src/pages/[platform]/index.page.tsx

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import type { SandpackThemeProp } from '@codesandbox/sandpack-react';
2828
import { theme } from '../../theme';
2929
import { ThemeButton } from '../ThemeButton';
3030
import { useCustomRouter } from '@/components/useCustomRouter';
31+
import { FRAMEWORKS } from '@/data/frameworks';
3132

3233
const code = `import { AmplifyProvider, Button, Card, Text, Heading, Flex, Badge, Image, StepperField, useTheme } from '@aws-amplify/ui-react';
3334
import '@aws-amplify/ui-react/styles.css';
@@ -202,26 +203,14 @@ const HomePage = ({ colorMode }) => {
202203
flex="1"
203204
display={{ base: 'none', large: 'initial' }}
204205
>
205-
<Image
206-
alt="React logo"
207-
className="docs-home-react"
208-
src="/svg/integrations/react.svg"
209-
/>
210-
<Image
211-
alt="Angular logo"
212-
className="docs-home-angular"
213-
src="/svg/integrations/angular.svg"
214-
/>
215-
<Image
216-
alt="Vue logo"
217-
className="docs-home-vue"
218-
src="/svg/integrations/vue.svg"
219-
/>
220-
<Image
221-
alt="Flutter logo"
222-
className="docs-home-flutter"
223-
src="/svg/integrations/flutter.svg"
224-
/>
206+
{FRAMEWORKS.map((framework) => (
207+
<Image
208+
key={framework}
209+
alt={`${framework} logo`}
210+
className={`docs-home-${framework}`}
211+
src={`/svg/integrations/${framework}.svg`}
212+
/>
213+
))}
225214
</Flex>
226215
</Flex>
227216
</View>

0 commit comments

Comments
 (0)