Skip to content

Commit

Permalink
Add underline
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Nov 5, 2024
1 parent b3b0d0a commit 14ded4b
Showing 3 changed files with 12 additions and 25 deletions.
26 changes: 3 additions & 23 deletions centrifuge-app/src/components/Tooltips.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import { Tooltip as FabricTooltip, Text, TextProps } from '@centrifuge/fabric'
import * as React from 'react'
import { useParams } from 'react-router'
import styled from 'styled-components'
import { usePool } from '../utils/usePools'

const StyledText = styled(Text)<{ hoverable?: boolean }>`
${({ hoverable }) =>
hoverable &&
`
&:hover {
text-decoration: underline
}
`}
`
function ValueLockedTooltipBody({ poolId }: { poolId?: string }) {
const { pid: poolIdParam } = useParams<{ pid: string }>()
const pool = usePool(poolId || poolIdParam || '', false)
@@ -364,31 +354,21 @@ export type TooltipsProps = {
props?: any
size?: 'med' | 'sm' | 'xs'
color?: string
hoverable?: boolean
} & Partial<Pick<TextProps, 'style' | 'body'>>

export function Tooltips({
type,
label: labelOverride,
size = 'sm',
props,
color,
hoverable = false,
...textProps
}: TooltipsProps) {
export function Tooltips({ type, label: labelOverride, size = 'sm', props, color, ...textProps }: TooltipsProps) {
const { label, body } = type ? tooltipText[type] : { label: labelOverride, body: textProps.body }
return (
<FabricTooltip body={React.isValidElement(body) ? React.cloneElement(body, props) : body} {...textProps}>
{typeof label === 'string' ? (
<StyledText
<Text
textAlign="left"
variant={size === 'sm' ? 'label2' : size === 'xs' ? 'body4' : 'label1'}
color={size === 'sm' && !color ? 'textPrimary' : 'textSecondary'}
fontWeight={size === 'sm' ? 'inherit' : 400}
hoverable={hoverable}
>
{labelOverride || label}
</StyledText>
</Text>
) : (
label
)}
4 changes: 4 additions & 0 deletions centrifuge-app/src/pages/Pool/Assets/OffchainMenu.tsx
Original file line number Diff line number Diff line change
@@ -33,6 +33,10 @@ const StyledButton = styled(Box)`
display: flex;
align-items: center;
font-family: Inter, sans-serif;
&:hover {
text-decoration: underline;
cursor: pointer;
}
`

const LoanOption = ({ loan }: LoanOptionProps) => {
7 changes: 5 additions & 2 deletions centrifuge-app/src/pages/Pool/Assets/index.tsx
Original file line number Diff line number Diff line change
@@ -22,6 +22,9 @@ const StyledRouterTextLink = styled(RouterTextLink)`
text-decoration: unset;
display: flex;
align-items: center;
&:hover {
text-decoration: underline;
}
`

export function PoolDetailAssetsTab() {
@@ -92,7 +95,7 @@ export function PoolDetailAssets() {
heading: true,
},
{
label: <Tooltips hoverable label={`Onchain reserve (${pool.currency.symbol})`} type="onchainReserve" />,
label: <Tooltips label={`Onchain reserve (${pool.currency.symbol})`} type="onchainReserve" />,
value: (
<StyledRouterTextLink to={`${basePath}/${pool.id}/assets/0`}>
<Text>{formatBalance(pool.reserve.total || 0)}</Text>
@@ -104,7 +107,7 @@ export function PoolDetailAssets() {
...(!isTinlakePool && cashLoans.length
? [
{
label: <Tooltips hoverable label="Offchain cash (USD" type="offchainCash" />,
label: <Tooltips label="Offchain cash (USD" type="offchainCash" />,
value: <OffchainMenu value={formatBalance(offchainReserve)} loans={cashLoans} />,
heading: false,
},

0 comments on commit 14ded4b

Please sign in to comment.