aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/demos/ProvidersDemo.tsx
blob: 48f5a9ffa88fc68df4e9fe0bb8dd84388823f4a1 (plain)
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
import { Button } from '@astryxdesign/core/Button'
import { HStack } from '@astryxdesign/core/HStack'
import { Link } from '@astryxdesign/core/Link'
import { Text } from '@astryxdesign/core/Text'
import { VStack } from '@astryxdesign/core/VStack'
import { useThemeMode } from '../theme/useThemeMode'

export function ProvidersDemo() {
  const { mode, toggleMode } = useThemeMode()
  const nextModeLabel = mode === 'light' ? '切换到深色主题' : '切换到浅色主题'

  return (
    <VStack gap={3}>
      <Text type="body" color="secondary" as="p">
        当前页面已经由 Theme、LinkProvider 和 InternationalizationProvider
        包裹。切换主题或点击站内链接即可看到实际效果。
      </Text>
      <HStack gap={3} wrap="wrap" vAlign="center">
        <Button label={nextModeLabel} variant="primary" onClick={toggleMode} />
        <Link href="/about" isStandalone>
          通过 LinkProvider 打开的站内链接
        </Link>
      </HStack>
      <Text type="supporting" size="sm">
        Astryx 内置文案同样是中文,例如「必填」「关闭」「跳至内容」。
      </Text>
    </VStack>
  )
}