import React from 'react';
import {
Box,
Table,
TableHead,
TableRow,
TableBody,
TableContainer,
TableCell,
useTheme,
SxProps,
} from '@mui/material';
import { StyledTypography } from './styled';
import { tokenCoreColor } from '@/foundation/colors/token/core';
import { tokenComponentColor } from '@/foundation/colors/token/component';
import type { ColorToken } from '@/foundation/colors/types';
import type { ColorTokenValueBySurface } from '@/foundation/colors/token/types';
interface TokenPaletteTableProps {
kind: keyof ColorToken;
}
const TokenPaletteTable = ({ kind }: TokenPaletteTableProps) => {
const theme = useTheme();
const colorTokenMap = Object.entries(
kind === 'core' ? theme.palette.lunit_token.core : theme.palette.lunit_token.component,
);
const TokenPaletteCell = (props: {
surface: keyof ColorTokenValueBySurface;
paletteKey: string;
sx?: SxProps;
}) => {
const { surface, paletteKey, sx } = props;
const tokenComponentColorFlatten = Object.values(tokenComponentColor).reduce((acc, cur) => {
return { ...acc, ...cur };
}, {});
const boxColorByToken =
kind === 'core'
? theme.palette.lunit_token.core[paletteKey as keyof ColorToken['core']]
: theme.palette.lunit_token.component[paletteKey as keyof ColorToken['component']];
const globalColorByToken =
kind === 'core' ? tokenCoreColor[paletteKey] : tokenComponentColorFlatten[paletteKey];
return (
{globalColorByToken[surface]}
);
};
return (
Light
Dark
Token name
Light 1
Light 2
Dark 1
Dark 2
{colorTokenMap.map(([paletteKey]) => (
{kind}.{paletteKey}
))}
);
};
export default TokenPaletteTable;