import { mergeProps, Show, For } from "solid-js";

import TableItem from "./tableItem";

import "./table.css"

function table(props) {
    const parentProps = mergeProps(props);
    return <div class={"table " + (props.localclass || "") }>
        <Show when={parentProps.head && parentProps.head.length}>
            <div class="head">
                <TableItem list={parentProps.head || []} />
            </div>
        </Show>
        <Show when={parentProps.body && parentProps.body.length}>
            <div class="bodyB">
                <div class="body">
                    <For each={parentProps.body}>
                        {(b) => (
                            <TableItem showColor={b.color || "rgb(215 1 1 / 60%)"} list={b.col || []} />
                        )}
                    </For>
                </div>
            </div>
        </Show>
    </div>
}

export default table;
