feat: highlight network param targeted by anchor
This commit is contained in:
parent
4fd6630ca5
commit
2cdb594c76
@ -24,10 +24,10 @@ describe('NetworkParametersTable', () => {
|
||||
);
|
||||
const rows = screen.getAllByTestId('key-value-table-row');
|
||||
expect(rows[0].children[0]).toHaveTextContent(
|
||||
'Market Fee Factors Infrastructure Fee'
|
||||
'market.fee.factors.infrastructureFee'
|
||||
);
|
||||
expect(rows[1].children[0]).toHaveTextContent(
|
||||
'Market Liquidity Provision Min Lp Stake Quantum Multiple'
|
||||
'market.liquidityProvision.minLpStakeQuantumMultiple'
|
||||
);
|
||||
expect(rows[0].children[1]).toHaveTextContent('0.0005');
|
||||
expect(rows[1].children[1]).toHaveTextContent('1');
|
||||
@ -54,10 +54,10 @@ describe('NetworkParametersTable', () => {
|
||||
);
|
||||
const rows = screen.getAllByTestId('key-value-table-row');
|
||||
expect(rows[0].children[0]).toHaveTextContent(
|
||||
'Market Fee Factors Infrastructure Fee'
|
||||
'market.fee.factors.infrastructureFee'
|
||||
);
|
||||
expect(rows[1].children[0]).toHaveTextContent(
|
||||
'Market Liquidity Provision Min Lp Stake Quantum Multiple'
|
||||
'market.liquidityProvision.minLpStakeQuantumMultiple'
|
||||
);
|
||||
expect(rows[0].children[1]).toHaveTextContent('0.0005');
|
||||
expect(rows[1].children[1]).toHaveTextContent('1');
|
||||
|
@ -16,7 +16,6 @@ import type {
|
||||
NetworkParametersQuery_networkParameters,
|
||||
} from './__generated__/NetworkParametersQuery';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import startCase from 'lodash/startCase';
|
||||
|
||||
const BIG_NUMBER_PARAMS = [
|
||||
'spam.protection.delegation.min.tokens',
|
||||
@ -42,8 +41,13 @@ export const renderRow = ({
|
||||
}: NetworkParametersQuery_networkParameters) => {
|
||||
const isSyntaxRow = isJsonObject(value);
|
||||
return (
|
||||
<KeyValueTableRow key={key} inline={!isSyntaxRow}>
|
||||
{startCase(key)}
|
||||
<KeyValueTableRow
|
||||
key={key}
|
||||
inline={!isSyntaxRow}
|
||||
id={key}
|
||||
className={'target:bg-vega-yellow target:text-black'}
|
||||
>
|
||||
{key}
|
||||
{isSyntaxRow ? (
|
||||
<SyntaxHighlighter data={JSON.parse(value)} />
|
||||
) : isNaN(Number(value)) ? (
|
||||
|
@ -90,3 +90,19 @@ it('Applies muted class if prop is passed', () => {
|
||||
'w-full border-collapse mb-8 [border-spacing:0] break-all'
|
||||
);
|
||||
});
|
||||
|
||||
it('Applies id to row if passed', () => {
|
||||
render(
|
||||
<KeyValueTable>
|
||||
<KeyValueTableRow inline={false} id="thisistheid">
|
||||
<span>My value</span>
|
||||
<span>My value</span>
|
||||
</KeyValueTableRow>
|
||||
</KeyValueTable>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('key-value-table-row')).toHaveAttribute(
|
||||
'id',
|
||||
'thisistheid'
|
||||
);
|
||||
});
|
||||
|
@ -77,6 +77,7 @@ export const KeyValueTableRow = ({
|
||||
noBorder = false,
|
||||
dtClassName,
|
||||
ddClassName,
|
||||
id,
|
||||
}: KeyValueTableRowProps) => {
|
||||
const dlClassName = classNames(
|
||||
'flex gap-1 flex-wrap justify-between ',
|
||||
@ -98,8 +99,17 @@ export const KeyValueTableRow = ({
|
||||
ddClassName
|
||||
);
|
||||
|
||||
const attributes = {} as Partial<React.HTMLProps<HTMLDListElement>>;
|
||||
if (id) {
|
||||
attributes.id = id;
|
||||
}
|
||||
|
||||
return (
|
||||
<dl className={dlClassName} data-testid="key-value-table-row">
|
||||
<dl
|
||||
className={dlClassName}
|
||||
data-testid="key-value-table-row"
|
||||
{...attributes}
|
||||
>
|
||||
<dt className={dtClassNames}>{children[0]}</dt>
|
||||
<dd className={ddClassNames}>{children[1]}</dd>
|
||||
</dl>
|
||||
|
Loading…
Reference in New Issue
Block a user