Skip to content

Commit

Permalink
Use a useBoolean to open the staking modal
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Dec 15, 2023
1 parent f74104e commit eebd8a6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions dapp/src/components/Overview/PositionDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react"
import React from "react"
import {
Text,
Button,
Expand All @@ -9,13 +9,14 @@ import {
CardFooter,
HStack,
CardProps,
useBoolean,
} from "@chakra-ui/react"
import { BITCOIN, USD } from "../../constants"
import { Info } from "../../static/icons"
import StakingModal from "../StakingModal"

export default function PositionDetails(props: CardProps) {
const [isOpenStakingModal, setIsOpenStakingModal] = useState(false)
const [isOpenStakingModal, stakingModal] = useBoolean()

return (
<Card {...props}>
Expand All @@ -36,17 +37,14 @@ export default function PositionDetails(props: CardProps) {
</CardBody>
<CardFooter flexDirection="column" gap={2}>
{/* TODO: Handle click actions */}
<Button size="lg" onClick={() => setIsOpenStakingModal(true)}>
<Button size="lg" onClick={stakingModal.on}>
Stake
</Button>
<Button size="lg" variant="outline">
Unstake
</Button>
</CardFooter>
<StakingModal
isOpen={isOpenStakingModal}
onClose={() => setIsOpenStakingModal(false)}
/>
<StakingModal isOpen={isOpenStakingModal} onClose={stakingModal.off} />
</Card>
)
}

0 comments on commit eebd8a6

Please sign in to comment.