Skip to content

Commit

Permalink
docs(ColorPage): improving Table typing
Browse files Browse the repository at this point in the history
  • Loading branch information
VadymBezpalko committed Jan 29, 2024
1 parent f0a0bc0 commit 7a5da21
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/react-components/src/docs/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ import * as React from 'react';
import './Table.css';
import { handleCopyText } from '../../helpers';

interface ITable<T> {
data: T[];
type BasicTableData = Record<string, unknown> & {
enum: string;
value: string;
deprecated?: boolean;
};

interface ITable {
data: BasicTableData[];
columnNames: string[];
renderExample?: (token: string) => React.ReactNode;
}

export const Table: React.FC<ITable<Record<string, unknown>>> = ({
export const Table: React.FC<ITable> = ({
data,
columnNames,
renderExample,
Expand All @@ -30,7 +36,7 @@ export const Table: React.FC<ITable<Record<string, unknown>>> = ({
if (cellIndex === 0) {
return (
<td onClick={() => handleCopyText(value as string)}>
{renderExample && renderExample(row['value'] as string)}
{renderExample && renderExample(row['value'])}
{row['enum']}
{row['deprecated'] && <i> (deprecated)</i>}
</td>
Expand Down

0 comments on commit 7a5da21

Please sign in to comment.