commit
aa0aca81d6
10 changed files with 115 additions and 13 deletions
15
src/components/UI/TooltipWrapper/index.tsx
Normal file
15
src/components/UI/TooltipWrapper/index.tsx
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { classes } from '@/utils/utils';
|
||||||
|
import styles from './styles.module.scss';
|
||||||
|
import { TooltipWrapperProps } from './types';
|
||||||
|
|
||||||
|
const TooltipWrapper = ({ children, text, className }: TooltipWrapperProps) => {
|
||||||
|
return (
|
||||||
|
<div className={styles.tooltip}>
|
||||||
|
{children}
|
||||||
|
|
||||||
|
<div className={classes(styles.tooltip__text, className)}>{text}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TooltipWrapper;
|
||||||
48
src/components/UI/TooltipWrapper/styles.module.scss
Normal file
48
src/components/UI/TooltipWrapper/styles.module.scss
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
.tooltip {
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
width: max-content;
|
||||||
|
display: grid;
|
||||||
|
place-content: center;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.tooltip__text {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
z-index: 10;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 3px);
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background-color: #11316B;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 100%;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background-color: #11316B;
|
||||||
|
top: 0;
|
||||||
|
left: 50%;
|
||||||
|
transform: rotate(45deg) translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="light"] & {
|
||||||
|
background-color: #D2E8FB;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
background-color: #D2E8FB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/components/UI/TooltipWrapper/types.ts
Normal file
7
src/components/UI/TooltipWrapper/types.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
|
export interface TooltipWrapperProps {
|
||||||
|
children: ReactNode;
|
||||||
|
text: string;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
@ -95,7 +95,7 @@ $table-radius: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> img {
|
img {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
background: var(--icon-bg-color);
|
background: var(--icon-bg-color);
|
||||||
|
|
@ -139,4 +139,4 @@ $table-radius: 10px;
|
||||||
background-color: var(--table-button-bg-hover);
|
background-color: var(--table-button-bg-hover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,8 @@ import { Store } from '@/store/store-reducer';
|
||||||
import PairData from '@/interfaces/common/PairData';
|
import PairData from '@/interfaces/common/PairData';
|
||||||
import { ContextState } from '@/interfaces/common/ContextValue';
|
import { ContextState } from '@/interfaces/common/ContextValue';
|
||||||
import { tradingKnownCurrencies, roundTo, notationToString, getAssetIcon } from '@/utils/utils';
|
import { tradingKnownCurrencies, roundTo, notationToString, getAssetIcon } from '@/utils/utils';
|
||||||
|
import Tooltip from '@/components/UI/Tooltip/Tooltip';
|
||||||
|
import TooltipWrapper from '@/components/UI/TooltipWrapper';
|
||||||
import styles from './PairsTable.module.scss';
|
import styles from './PairsTable.module.scss';
|
||||||
import { Row } from './types';
|
import { Row } from './types';
|
||||||
|
|
||||||
|
|
@ -40,6 +42,7 @@ function transformPairsToRows(pairs: PairData[], state: ContextState): Row[] {
|
||||||
volume,
|
volume,
|
||||||
volumeUSD,
|
volumeUSD,
|
||||||
featured: pair.featured,
|
featured: pair.featured,
|
||||||
|
whitelisted: pair.whitelisted,
|
||||||
code: tradingKnownCurrencies.includes(pair.first_currency?.code)
|
code: tradingKnownCurrencies.includes(pair.first_currency?.code)
|
||||||
? pair.first_currency?.code
|
? pair.first_currency?.code
|
||||||
: 'tsds',
|
: 'tsds',
|
||||||
|
|
@ -69,6 +72,7 @@ function PairsTable({ data }: IProps) {
|
||||||
pair: { base, quote },
|
pair: { base, quote },
|
||||||
featured,
|
featured,
|
||||||
assetId,
|
assetId,
|
||||||
|
whitelisted,
|
||||||
} = row.original;
|
} = row.original;
|
||||||
return (
|
return (
|
||||||
<div className={styles.pair_cell}>
|
<div className={styles.pair_cell}>
|
||||||
|
|
@ -84,13 +88,26 @@ function PairsTable({ data }: IProps) {
|
||||||
<span>{quote.name}</span>
|
<span>{quote.name}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{whitelisted && (
|
||||||
|
<TooltipWrapper text="Whitelisted">
|
||||||
|
<Image
|
||||||
|
src="/ui/whitelisted.svg"
|
||||||
|
alt="whitelisted"
|
||||||
|
width={18}
|
||||||
|
height={18}
|
||||||
|
/>
|
||||||
|
</TooltipWrapper>
|
||||||
|
)}
|
||||||
|
|
||||||
{featured && (
|
{featured && (
|
||||||
<Image
|
<TooltipWrapper text="Featured">
|
||||||
src="/ui/featured.svg"
|
<Image
|
||||||
alt="featured"
|
src="/ui/featured.svg"
|
||||||
width={24}
|
alt="featured"
|
||||||
height={24}
|
width={18}
|
||||||
/>
|
height={18}
|
||||||
|
/>
|
||||||
|
</TooltipWrapper>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,6 @@ export type Row = {
|
||||||
volume: number;
|
volume: number;
|
||||||
volumeUSD: string;
|
volumeUSD: string;
|
||||||
featured: boolean;
|
featured: boolean;
|
||||||
|
whitelisted: boolean;
|
||||||
code: string;
|
code: string;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svg:not(.stroked):not(.no-svg-style svg) * {
|
||||||
|
fill: transparent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__tooltip {
|
&__tooltip {
|
||||||
|
|
@ -33,4 +37,4 @@
|
||||||
background-color: var(--trade-table-tooltip) !important;
|
background-color: var(--trade-table-tooltip) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ interface PairData {
|
||||||
low?: number;
|
low?: number;
|
||||||
volume: number;
|
volume: number;
|
||||||
featured: boolean;
|
featured: boolean;
|
||||||
|
whitelisted: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PairData;
|
export default PairData;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
.card__header {
|
.card__header {
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
||||||
border-top-left-radius: 10px;
|
border-top-left-radius: 10px;
|
||||||
border-top-right-radius: 10px;
|
border-top-right-radius: 10px;
|
||||||
background-color: var(--table-header-bg);
|
background-color: var(--table-header-bg);
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> img {
|
img {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
background: var(--icon-bg-color);
|
background: var(--icon-bg-color);
|
||||||
|
|
@ -128,4 +128,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import ArrowRight from '@/assets/images/UI/arrow_right.svg';
|
||||||
import { Store } from '@/store/store-reducer';
|
import { Store } from '@/store/store-reducer';
|
||||||
import PairData from '@/interfaces/common/PairData';
|
import PairData from '@/interfaces/common/PairData';
|
||||||
import { getAssetIcon, notationToString, roundTo } from '@/utils/utils';
|
import { getAssetIcon, notationToString, roundTo } from '@/utils/utils';
|
||||||
|
import TooltipWrapper from '@/components/UI/TooltipWrapper';
|
||||||
import styles from './PairsCard.module.scss';
|
import styles from './PairsCard.module.scss';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
|
@ -19,6 +20,7 @@ export default function PairsCard({ pair }: IProps) {
|
||||||
const secondCurrency = pair.second_currency;
|
const secondCurrency = pair.second_currency;
|
||||||
|
|
||||||
const isFeatured = pair.featured;
|
const isFeatured = pair.featured;
|
||||||
|
const isWhitelisted = pair.whitelisted;
|
||||||
|
|
||||||
const secondAssetUsdPrice = state.assetsRates.get(secondCurrency.asset_id || '') ?? 0;
|
const secondAssetUsdPrice = state.assetsRates.get(secondCurrency.asset_id || '') ?? 0;
|
||||||
|
|
||||||
|
|
@ -58,8 +60,15 @@ export default function PairsCard({ pair }: IProps) {
|
||||||
<span>/</span>
|
<span>/</span>
|
||||||
<span>{secondCurrency.name}</span>
|
<span>{secondCurrency.name}</span>
|
||||||
</div>
|
</div>
|
||||||
|
{isWhitelisted && (
|
||||||
|
<TooltipWrapper text="Whitelisted">
|
||||||
|
<Image src="/ui/whitelisted.svg" alt="whitelisted" width={24} height={24} />
|
||||||
|
</TooltipWrapper>
|
||||||
|
)}
|
||||||
{isFeatured && (
|
{isFeatured && (
|
||||||
<Image src="/ui/featured.svg" alt="featured" width={24} height={24} />
|
<TooltipWrapper text="Featured">
|
||||||
|
<Image src="/ui/featured.svg" alt="featured" width={24} height={24} />
|
||||||
|
</TooltipWrapper>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.card__body}>
|
<div className={styles.card__body}>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue