vega-frontend-monorepo/apps/trading/components/select-market/select-market-table.tsx
macqbat 406b69566f
Feat/1491 insert accounts and positions (#1515)
* feat: inserts of new item in positions

* feat: inserts of new item in positions - move select-market to app dir

* feat: inserts of new item in positions - add delta to update

* feat: inserts of new item in positions - fix e2e mocks

* feat: inserts of new item in positions - fix e2e mocks

* feat: inserts of new item in positions - adjust e2e mocks

* feat: inserts of new item in positions - adjust e2e tests

* feat: inserts of new item in positions - adjust e2e tests

* feat: inserts of new item in positions - adjust e2e trading tests

* feat: inserts of new item in positions - adjust e2e account tests

* feat: inserts of new item in positions - adjust e2e account tests

* feat: inserts of new item in positions - adjust e2e account tests

* feat: inserts of new item in accounts - manage inserting new accounts

* feat: inserts of new item in accounts - adjust console-lite tests

* feat: inserts of new item in accounts - adjust console-v2 tests

* feat: inserts of new item in accounts - adjust console-v2 tests

* feat: inserts of new item in accounts - clean up after merge

* feat: inserts of new item in accounts - fixes after feedback

Co-authored-by: maciek <maciek@vegaprotocol.io>
2022-10-04 10:37:31 +02:00

64 lines
1.6 KiB
TypeScript

import classNames from 'classnames';
import type { Column } from './select-market-columns';
import { columnHeaders } from './select-market-columns';
export const SelectMarketTableHeader = ({
detailed = false,
headers = columnHeaders,
}) => {
return (
<tr className="sticky top-0 z-10 border-b border-default bg-inherit">
{headers.map(({ kind, value, className, onlyOnDetailed }) => {
const thClass = classNames(
'font-normal text-neutral-500 dark:text-neutral-400',
className
);
if (!onlyOnDetailed || detailed === onlyOnDetailed) {
return (
<th key={kind} className={thClass}>
{value}
</th>
);
}
return null;
})}
</tr>
);
};
export const SelectMarketTableRow = ({
detailed = false,
columns,
onSelect,
marketId,
}: {
detailed?: boolean;
columns: Column[];
onSelect: (id: string) => void;
marketId: string;
}) => {
return (
<tr
className={`hover:bg-neutral-200 dark:hover:bg-neutral-700 cursor-pointer relative h-[34px]`}
onClick={() => {
onSelect(marketId);
}}
data-testid={`market-link-${marketId}`}
>
{columns.map(({ kind, value, className, dataTestId, onlyOnDetailed }) => {
if (!onlyOnDetailed || detailed === onlyOnDetailed) {
const tdClass = classNames(className);
return (
<td key={kind} data-testid={dataTestId} className={tdClass}>
{value}
</td>
);
}
return null;
})}
</tr>
);
};