Fix story

This commit is contained in:
Hristo Nedelkov 2023-08-16 14:55:37 +03:00
parent 0051948d1d
commit 27eed45c2a
3 changed files with 9 additions and 11 deletions

View File

@ -15,11 +15,9 @@ import CompleteId from '../../components/Icons/CompleteId'
const PairDevice = () => {
const [autoChecked, setAutoChecked] = useState(false)
const isPaired = true
const [isPairing, setIsPairing] = useState(true)
const isPairing = true
console.log(uuidv4())
const resetTimer = () => {
setIsPairing(false)
}
return (
<PageWrapperShadow rightImageSrc="/background-images/day-night-bg.png">
<YStack
@ -45,7 +43,7 @@ const PairDevice = () => {
</Button>
</XStack>
<Separator borderColor={'#e3e3e3'} />
<SyncStatus isPairing={isPairing} onResetTimer={resetTimer} />
<SyncStatus isPairing={isPairing} />
<Separator borderColor={'#e3e3e3'} />
<Text size={19} weight={'semibold'} color="#09101C">
Settings

View File

@ -18,6 +18,5 @@ type Story = StoryObj<typeof meta>
export const Page: Story = {
args: {
isPairing: true,
onResetTimer: () => {},
},
}

View File

@ -7,16 +7,17 @@ import BlockIcon from '/icons/block.svg'
import ConnectionIcon from '/icons/connection.svg'
import { convertSecondsToTimerFormat } from '../../utilities'
import { useEffect, useState } from 'react'
type SyncStatusProps = {
isPairing: boolean
onResetTimer: () => void
}
const SyncStatus = ({ isPairing, onResetTimer }: SyncStatusProps) => {
const SyncStatus = ({ isPairing }: SyncStatusProps) => {
const [elapsedTime, setElapsedTime] = useState(0)
const [isAwaitingPairing, setIsAwaitingPairing] = useState(false)
const resetTimer = () => {
setElapsedTime(0)
setIsAwaitingPairing(false)
}
useEffect(() => {
let timer: ReturnType<typeof setTimeout>
@ -53,7 +54,7 @@ const SyncStatus = ({ isPairing, onResetTimer }: SyncStatusProps) => {
)}
<IconButton
icon={<Icon src={isPairing ? RefreshBlackIcon : RefreshIcon} />}
onPress={onResetTimer}
onPress={resetTimer}
variant="ghost"
/>
</XStack>