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
Show file tree
Hide file tree
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)
Expand Down Expand Up @@ -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
)}
Expand Down
4 changes: 4 additions & 0 deletions centrifuge-app/src/pages/Pool/Assets/OffchainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
7 changes: 5 additions & 2 deletions centrifuge-app/src/pages/Pool/Assets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const StyledRouterTextLink = styled(RouterTextLink)`
text-decoration: unset;
display: flex;
align-items: center;
&:hover {
text-decoration: underline;
}
`

export function PoolDetailAssetsTab() {
Expand Down Expand Up @@ -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>
Expand All @@ -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,
},
Expand Down

0 comments on commit 14ded4b

Please sign in to comment.