import { useState } from 'react'; import { useRouter } from 'next/router'; import { Card, Badge, Button, Flex, ToggleButton, ToggleButtonGroup, Text, ThemeProvider, Grid, View, SwitchField, SliderField, TabItem, Tabs, Alert, Loader, Icon, CheckboxField, RadioGroupField, Radio, SearchField, useBreakpointValue, Image, Authenticator, VisuallyHidden, } from '@aws-amplify/ui-react'; import { CgTerminal, CgLinear, CgCopyright } from 'react-icons/cg'; import themePreval from './themes/index.preval'; import { HomeCode } from '@/components/home/HomeCode'; import { CodeHighlight } from '@/components/CodeHighlight'; import { trackClick } from '@/utils/track'; const colorKeys = [10, 20, 40, 60, 80, 90, 100]; const scale = ['primary', 'secondary', 'tertiary', 'success', 'info', 'error']; const Swatch = ({ color }) => ( ); const Preview = ({ platform }) => { const [exclusiveValue, setExclusiveValue] = useState('align-left'); const isMobile = useBreakpointValue({ base: true, medium: false, }); if (platform !== 'react') { return ( ); } return ( setExclusiveValue(value)} > Sm Md Lg XL $29.99 20% off {isMobile ? null : ( <> HTML CSS Javascript {scale.map((level) => ( Aa ))} {colorKeys.map((key) => ( ))} {colorKeys.map((key) => ( ))} Studio{' '} new } > )} ); }; const language = { react: 'javascript', angular: 'css', vue: 'css', }; const fileName = { react: 'theme.ts', angular: 'styles.css', vue: 'styles.css', }; export const ThemeSwitcher = ({ colorMode }) => { const [theme, setTheme] = useState('default'); const { query: { platform = 'react' }, } = useRouter(); const isMobile = useBreakpointValue({ base: true, large: false, }); return ( { setTheme(value as string); trackClick('HomeThemeSwitch', { value }); }} > {isMobile ? Default : 'Default'} {isMobile ? Terminal : 'Terminal'} {isMobile ? Synthwave : 'Synthwave'} {isMobile ? Classic : 'Classic'} {isMobile ? null : ( )} ); };