Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mastro-elfo/crosstable

Crosstable component for @mui/material
https://github.com/mastro-elfo/crosstable

mui mui-material react react-typescript reactjs typescript vite vitest

Last synced: 12 days ago
JSON representation

Crosstable component for @mui/material

Awesome Lists containing this project

README

        

[![Publish library](https://github.com/mastro-elfo/crosstable/actions/workflows/publish.yml/badge.svg)](https://github.com/mastro-elfo/crosstable/actions/workflows/publish.yml)

# CrossTable

# Install

```
yarn add mui-crosstable
```

```
npm i mui-crosstable
```

# Usage

Type `CustomTeam` must extend `{ id: number | string }`.

```tsx
import CrossTable from "mui-crosstable";

function CrossTablePage(){
return (

teams={LIST_OF_TEAMS}
diagonalProps={{}}
renderDiagonal={(team) => "/"}
renderResult={(team1, team2) => getResultBetween(team1, team2)}
renderTeamName={(team) => getTeamName(team)}
renderShortTeamName={(team) => getShortTeamName(team)}
i18n={ teams: translate("Teams") }
resultCellProps={{}}
shortTeamNameCellProps={{}}
tableCellProps={{}}
tableContainerProps={{}}
tableHeadCellProps={{}}
tableProps={{}}
teamNameCellProps={{}}
/>
);
}
```

# Properties

Type `Team` extends `{ id: number | string }`.

| property | type | description |
| ---------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------- |
| teams | mandatory, `Team[]` | List of teams or players |
| diagonalProps | optional, `Omit` | Properties applied to each diagonal `TableCell` |
| renderDiagonal | optional, `(primary: Team) => ReactNode` | Called to render the content of a diagonal cell |
| renderResult | optional, `(primary: Team, secondary: Team) => ReactNode` | Called to render the result between two teams |
| renderTeamName | optional, `(team: Team) => ReactNode` | Called to render the team name |
| renderShortTeamName | optional, `(team: Team) => ReactNode` | Called to render the short version of the name |
| i18n | optional, `{teams: string;}` | Override the default texts |
| resultCellProps | optional, `Omit` | Properties applied to each `TableCell` with results |
| shortTeamNameCellProps | optional, `Omit` | Properties applied to each `TableHeadCell` with team short names |
| tableCellProps | optional, `Omit` | Properties applied to each `TableCell` inside `TableBody` |
| tableContainerProps | optional, `Omit` | Properties applied to `TableContainer` |
| tableHeadCellProps | optional, `Omit, "children">` | Properties applied to each `TableHeadCell` |
| tableProps | optional, `Omit` | Properties applied to `Table` |
| teamNameCellProps | optional, `Omit` | Properties applied to each `TableCell` with team names |

# Release

1. Update package version
2. Commit/Push, eventually skipping CI