Update ConnectDevicePage.tsx

This commit is contained in:
Hristo Nedelkov 2023-12-15 12:24:13 +02:00
parent 569859f5f6
commit b65c19fbf9
1 changed files with 36 additions and 19 deletions

View File

@ -1,7 +1,7 @@
import { useState } from 'react' import { useEffect, useState } from 'react'
import BreadcrumbBar from '../../components/General/BreadcrumbBar/BreadcrumbBar' import BreadcrumbBar from '../../components/General/BreadcrumbBar/BreadcrumbBar'
import { Button as StatusButton, Text, Avatar, Checkbox } from '@status-im/components' import { Button as StatusButton, Text, Avatar, Checkbox } from '@status-im/components'
import { Label, Separator, XStack, YStack } from 'tamagui' import { Label, Separator, Stack, XStack, YStack } from 'tamagui'
import PageWrapperShadow from '../../components/PageWrappers/PageWrapperShadow' import PageWrapperShadow from '../../components/PageWrappers/PageWrapperShadow'
import Titles from '../../components/General/Titles' import Titles from '../../components/General/Titles'
import LabelInputField from '../../components/General/LabelInputField' import LabelInputField from '../../components/General/LabelInputField'
@ -11,6 +11,31 @@ import { NodeIcon } from '@status-im/icons'
const ConnectDevicePage = () => { const ConnectDevicePage = () => {
const [autoConnectChecked, setAutoConnectChecked] = useState(false) const [autoConnectChecked, setAutoConnectChecked] = useState(false)
const [portChecked, setPortChecked] = useState(false) const [portChecked, setPortChecked] = useState(false)
const [windowWidth, setWindowWidth] = useState(window.innerWidth)
useEffect(() => {
const handleResize = () => {
setWindowWidth(window.innerWidth)
}
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
}, [])
const breakpoint = 768
const responsiveXStackStyle = {
width: '100%',
alignItems: 'center',
justifyContent: 'space-between',
flexDirection: windowWidth <= breakpoint ? 'column' : 'row',
flexWrap: windowWidth <= breakpoint ? 'wrap' : 'nowrap',
}
const responsiveInputStyle = {
width: windowWidth <= breakpoint ? '100%' : '40%',
marginBottom: windowWidth <= breakpoint ? '1rem' : '0',
}
return ( return (
<PageWrapperShadow <PageWrapperShadow
@ -27,25 +52,17 @@ const ConnectDevicePage = () => {
subtitle="Configure your device to connect to the Nimbus Node Manager" subtitle="Configure your device to connect to the Nimbus Node Manager"
/> />
<YStack my={16}> <YStack my={16}>
<XStack <XStack style={responsiveXStackStyle}>
width={'100%'} <Stack style={responsiveInputStyle}>
alignItems="center"
justifyContent="space-between"
// media query
$lg={{
flexDirection: 'column',
flexWrap: 'nowrap',
}}
>
<XStack width={'40%'}>
<LabelInputField labelText="Beacon Address" placeholderText="something" /> <LabelInputField labelText="Beacon Address" placeholderText="something" />
</XStack> </Stack>
<XStack width={'25%'}> <Stack style={responsiveInputStyle}>
<LabelInputField labelText="Beacon Node Port" placeholderText="5052" /> <LabelInputField labelText="Beacon Node Port" placeholderText="5052" />
</XStack> </Stack>
<XStack width={'25%'}> <Stack style={responsiveInputStyle}>
<LabelInputField labelText="Client Validator Port" placeholderText="5052" /> <LabelInputField labelText="Client Validator Port" placeholderText="5052" />
</XStack> </Stack>
<YStack width={20}> <YStack width={20}>
<Checkbox <Checkbox
id="port-checkbox" id="port-checkbox"