Skip to content

Commit

Permalink
feat: add tooltips to market table headers (#1203)
Browse files Browse the repository at this point in the history
  • Loading branch information
therealemjy authored Jul 26, 2023
1 parent 503b8b6 commit e25d5ce
Show file tree
Hide file tree
Showing 14 changed files with 412 additions and 289 deletions.
2 changes: 1 addition & 1 deletion src/components/Table/TableCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function TableCards<R>({

const option: SelectOption = {
value: column.key,
label: column.label,
label: column.selectOptionLabel,
};

return [...acc, option];
Expand Down
4 changes: 4 additions & 0 deletions src/components/Table/storiesUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,27 @@ export const columns: TableColumn<Row>[] = [
{
key: 'asset',
label: 'Asset',
selectOptionLabel: 'Asset',
renderCell: ({ token }) => <TokenIconWithSymbol token={token} />,
},
{
key: 'apy',
label: 'APY',
selectOptionLabel: 'APY',
renderCell: ({ apy }) => (
<div style={{ color: '#18df8b' }}>{formatPercentageToReadableValue(apy)}</div>
),
},
{
key: 'wallet',
label: 'Wallet',
selectOptionLabel: 'Wallet',
renderCell: ({ wallet, token }) => `${wallet} ${token.symbol}`,
},
{
key: 'collateral',
label: 'Collateral',
selectOptionLabel: 'Collateral',
renderCell: ({ collateral }) => <Toggle onChange={console.log} value={collateral} />,
},
];
Expand Down
3 changes: 2 additions & 1 deletion src/components/Table/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { BREAKPOINTS } from 'theme/MuiThemeProvider/muiTheme';

export interface TableColumn<R> {
key: string;
label: string;
label: React.ReactNode | string;
selectOptionLabel: string;
renderCell: (row: R, rowIndex: number) => React.ReactNode | string;
sortRows?: (rowA: R, rowB: R, direction: 'asc' | 'desc') => number;
align?: 'left' | 'center' | 'right';
Expand Down
9 changes: 9 additions & 0 deletions src/containers/MarketTable/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ export const useStyles = () => {
const theme = useTheme();

return {
getColumnLabelInfoIcon: ({ hasRightMargin }: { hasRightMargin: boolean }) => css`
vertical-align: sub;
margin-left: ${theme.spacing(1)};
${hasRightMargin &&
css`
margin-right: ${theme.spacing(1)};
`};
`,
marketLink: css`
text-decoration: underline;
color: ${theme.palette.text.primary};
Expand Down
Loading

0 comments on commit e25d5ce

Please sign in to comment.