import { Table, Caption, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; interface Repository { name: string; branches: number; prs: number; workspaces: number; lastCommit: string; } export const TableStripedTr: React.FunctionComponent = () => { // In real usage, this data would come from some external source like an API via props. const repositories: Repository[] = [ { name: 'Repository 1', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' }, { name: 'Repository 2', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' }, { name: 'Repository 3', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' }, { name: 'Repository 4', branches: 10, prs: 25, workspaces: 5, lastCommit: '2 days ago' } ]; const columnNames = { name: 'Repositories', branches: 'Branches', prs: 'Pull requests', workspaces: 'Workspaces', lastCommit: 'Last commit' }; return ( {repositories.map((repo, index) => ( ))}
Manually striped table using composable components
{columnNames.name} {columnNames.branches} {columnNames.prs} {columnNames.workspaces} {columnNames.lastCommit}
{repo.name} {repo.branches} {repo.prs} {repo.workspaces} {repo.lastCommit}
); };