Fix theming in web app

This commit is contained in:
Pavel Prichodko 2023-01-16 16:19:06 +01:00
parent d2a3d65900
commit 98e9c1850d
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
2 changed files with 7 additions and 6 deletions

View File

@ -19,7 +19,7 @@ function App() {
const [theme, setTheme] = useState<ThemeVars>('light')
return (
<TamaguiProvider config={tamaguiConfig}>
<TamaguiProvider config={tamaguiConfig} defaultTheme={theme}>
<div id="app">
<div id="sidebar">
<Sidebar
@ -53,11 +53,11 @@ function App() {
<Paragraph marginVertical={20}>
Theme selected - {theme}{' '}
</Paragraph>
<button
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
<Button
onPress={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
>
Toogle theme
</button>
</Button>
<Shape marginTop={20} />
</Stack>
</Stack>

View File

@ -44,13 +44,14 @@ type BaseProps = GetProps<typeof Base>
interface Props {
type?: BaseProps['type']
children: string
onPress?: () => void
}
const Button = (props: Props) => {
const { type = 'primary', children } = props
const { type = 'primary', children, onPress } = props
return (
<Base type={type}>
<Base type={type} onPress={onPress}>
<ButtonText>{children}</ButtonText>
</Base>
)