* feat: added simulateTrade * MP-3330: added vault positions to the useUpdated Account * tidy: format * tidy: refactor * Health indicator change preview (#410) * fix: adjusted the AccountDetail width * feat: added health indicator updates * Update src/components/Account/AccountDetails.tsx Co-authored-by: Yusuf Seyrek <yusufseyrek@users.noreply.github.com> * fix: created a function for the back- and foregroundColors * fix: updated tailwind conf * fix: fixed the useHealthColorAndLabel function --------- Co-authored-by: Yusuf Seyrek <yusufseyrek@users.noreply.github.com> Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com> * fix: added updatedAccount to AccountSummary (#414) Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com> * fix: added a new way of calulating values to vaults * fix: refactored the displayCurrency * fix: fixed the subtitles, to not nest <p> tags * MP-3330: added comparison to the vault mechanics * fix: fixed tests * fix: updated the borrow slider percentage on vaults * fix: addressed change request * update displayValue stuff * fixed wrong display conversions * fix: fixed the display price and renamed getDepositsAndLendsAfterCoinSpent * fix test and update DisplayCurrency * tidy: refactor * tidy: rename method --------- Co-authored-by: Yusuf Seyrek <yusufseyrek@users.noreply.github.com> Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import classNames from 'classnames'
|
|
|
|
import { ChevronDown, ChevronRight } from 'components/Icons'
|
|
import Text from 'components/Text'
|
|
|
|
interface Props {
|
|
item: Item
|
|
index: number
|
|
}
|
|
|
|
export interface Item {
|
|
title: string
|
|
renderContent: () => React.ReactNode
|
|
isOpen?: boolean
|
|
renderSubTitle: () => React.ReactNode
|
|
toggleOpen: (index: number) => void
|
|
}
|
|
|
|
export default function AccordionContent(props: Props) {
|
|
const { title, renderContent, isOpen, renderSubTitle, toggleOpen } = props.item
|
|
|
|
return (
|
|
<div key={title} className='group border-b-white/10 [&:not(:last-child)]:border-b'>
|
|
<div
|
|
onClick={() => toggleOpen(props.index)}
|
|
className={classNames(
|
|
'mb-0 flex cursor-pointer items-center justify-between border-t border-white/10 bg-white/10 p-4 text-white',
|
|
'group-[&:first-child]:border-t-0 group-[[open]]:border-b',
|
|
'[&::marker]:hidden [&::marker]:content-[""]',
|
|
isOpen && 'border-b [&:first-child]:border-t-0',
|
|
)}
|
|
>
|
|
<div>
|
|
<Text>{title}</Text>
|
|
{renderSubTitle()}
|
|
</div>
|
|
<div className='block pr-1 group-[[open]]:hidden'>
|
|
{isOpen ? <ChevronDown className='h-1.5' /> : <ChevronRight className='w-1.5' />}
|
|
</div>
|
|
</div>
|
|
{isOpen && <div className='bg-white/5 transition-[padding]'>{renderContent()}</div>}
|
|
</div>
|
|
)
|
|
}
|