-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0dbf61b
commit ec07966
Showing
43 changed files
with
2,060 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import dynamic from 'next/dynamic' | ||
|
||
const CandleChart = dynamic(() => import('@lyra/ui/components/CandleChart'), { suspense: true, ssr: false }) | ||
|
||
export default CandleChart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import Box from '@lyra/ui/components/Box' | ||
import Button, { ButtonElement } from '@lyra/ui/components/Button' | ||
import Text from '@lyra/ui/components/Text' | ||
import useFontSize from '@lyra/ui/hooks/useFontSize' | ||
import { MarginProps } from '@lyra/ui/types' | ||
import formatPercentage from '@lyra/ui/utils/formatPercentage' | ||
import formatUSD from '@lyra/ui/utils/formatUSD' | ||
import { Quote } from '@lyrafinance/lyra-js' | ||
import React from 'react' | ||
|
||
import emptyFunction from '@/app/utils/emptyFunction' | ||
import fromBigNumber from '@/app/utils/fromBigNumber' | ||
|
||
type Props = { | ||
quote: Quote | ||
isBid: boolean | ||
isSelected: boolean | ||
onSelected: (isSelected: boolean) => void | ||
} & MarginProps | ||
|
||
export default function TradeChainPriceButton({ | ||
quote, | ||
isSelected, | ||
isBid, | ||
onSelected = emptyFunction, | ||
...styleProps | ||
}: Props): ButtonElement { | ||
const secondaryLineHeight = useFontSize('secondary') | ||
const smallLineHeight = useFontSize('small') | ||
return ( | ||
<Button | ||
minHeight={42} | ||
variant={isBid ? 'error' : 'primary'} | ||
textVariant="secondary" | ||
isTransparent={!isSelected} | ||
isDisabled={quote.isDisabled} | ||
label={ | ||
<Box> | ||
<Text variant="secondary" sx={{ lineHeight: `${secondaryLineHeight}px` }}> | ||
{formatUSD(quote.premium)} {!isSelected ? '+' : '✓'} | ||
</Text> | ||
<Text | ||
mt={1} | ||
textAlign="left" | ||
variant="small" | ||
color={isSelected ? 'inherit' : 'secondaryText'} | ||
sx={{ lineHeight: `${smallLineHeight}px` }} | ||
> | ||
{formatPercentage(fromBigNumber(quote.iv), true)} | ||
</Text> | ||
</Box> | ||
} | ||
onClick={e => { | ||
e.preventDefault() | ||
e.stopPropagation() | ||
e.nativeEvent.stopPropagation() | ||
onSelected(!isSelected) | ||
}} | ||
{...styleProps} | ||
/> | ||
) | ||
} |
Oops, something went wrong.