Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2dbe633
Add SimpleTable component - a clean table without gradients
pennyhailey Jan 31, 2026
f609586
Add SimpleTable styles
pennyhailey Jan 31, 2026
d0b8663
Add SimpleTable import in alphabetical order
pennyhailey Jan 31, 2026
db93682
Test patch - verify tool works
pennyhailey Jan 31, 2026
bd18960
Add SimpleTable import (alphabetically between SidebarLayout and Table)
pennyhailey Jan 31, 2026
97a69ab
test
pennyhailey Jan 31, 2026
860e490
Add SimpleTable import (alphabetically between SidebarLayout and Table)
pennyhailey Jan 31, 2026
0157c56
test
pennyhailey Feb 1, 2026
b4af1ff
test find
pennyhailey Feb 1, 2026
addd33e
Add SimpleTable demo section in alphabetical order (after SIDEBAR, be…
pennyhailey Feb 1, 2026
6e089bc
Add SIMPLE_TABLE_DATA constant for SimpleTable demo
pennyhailey Feb 1, 2026
a53f58d
Update app/page.tsx
pennyhailey Feb 1, 2026
d5f45f2
Add accordion section for SimpleTable component
pennyhailey Feb 1, 2026
8d0a8bf
Update app/page.tsx
pennyhailey Feb 1, 2026
6af0cac
Update app/page.tsx
pennyhailey Feb 1, 2026
38fbf30
Add SIMPLE_TABLE_DATA constant
pennyhailey Feb 1, 2026
556779a
Add SIMPLETABLE accordion section per Jim's request
pennyhailey Feb 1, 2026
2311358
Add SIMPLE_TABLE_DATA constant
pennyhailey Feb 1, 2026
c54d74e
Add SIMPLETABLE accordion section
pennyhailey Feb 1, 2026
525dd22
Add SIMPLE_TABLE_DATA constant and SIMPLETABLE accordion section
pennyhailey Feb 1, 2026
189e995
Add SIMPLETABLE accordion section
pennyhailey Feb 1, 2026
72769d9
Add SIMPLE_TABLE_DATA constant and SIMPLETABLE accordion section
pennyhailey Feb 1, 2026
d29c14d
Add SIMPLETABLE accordion section
pennyhailey Feb 1, 2026
eb8b1cd
Add SIMPLE_TABLE_DATA constant for SimpleTable demo
pennyhailey Feb 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import RowSpaceBetween from '@components/RowSpaceBetween';
import Script from 'next/script';
import Select from '@components/Select';
import SidebarLayout from '@components/SidebarLayout';
import SimpleTable from '@components/SimpleTable';
import Table from '@components/Table';
import TableRow from '@components/TableRow';
import TableColumn from '@components/TableColumn';
Expand All @@ -77,6 +78,14 @@ import ModalDOMSnake from '@root/components/modals/ModalDOMSnake';

export const dynamic = 'force-static';

const SIMPLE_TABLE_DATA = [
['Name', 'Role', 'Location'],
['Jimmy Lee', 'Staff Janitor', 'San Francisco'],
['Andrew Alimbuyuguen', 'Webmaster', 'San Francisco'],
['Anastasiya Uraleva', 'Webmaster', 'San Francisco'],
['Elijah Seed Arita', 'Webmaster', 'Los Angeles'],
];

// NOTE(jimmylee)
// https://nextjs.org/docs/app/api-reference/functions/generate-metadata
export async function generateMetadata({ params, searchParams }) {
Expand Down Expand Up @@ -1468,6 +1477,10 @@ int main() {
<br />
</Accordion>

<Accordion defaultValue={true} title="SIMPLETABLE">
<SimpleTable data={SIMPLE_TABLE_DATA} />
</Accordion>

<Accordion defaultValue={true} title="TABLE">
A simple, declarative table component designed to streamline the creation of tables in JSX. It provides greater control over the structure and layout while evoking the aesthetics of old terminal interfaces (like MS-DOS).
<br />
Expand Down
68 changes: 68 additions & 0 deletions components/SimpleTable.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.root {
position: relative;
width: 100%;
border-spacing: 0px;
max-width: 64ch;
border-collapse: collapse;
}

.head {
}

.body {
}

.headerRow {
border-bottom: 1px solid var(--theme-border);
}

.headerCell {
border: 0;
outline: 0;
padding: 4px 1ch 4px 0;
font-weight: 600;
text-align: left;
font-size: var(--font-size);

&:focus {
background: var(--theme-focused-foreground);
outline: 0;
}

&:first-child {
padding-left: 0px;
}
}

.row {
border-spacing: 0px;

&:hover {
background: var(--theme-background-secondary);
}

&:nth-child(even) {
background: var(--theme-background-secondary);

&:hover {
background: var(--theme-border);
}
}
}

.cell {
border: 0;
outline: 0;
padding: 4px 1ch 4px 0;
font-size: var(--font-size);
transition: background-color 0.2s ease;

&:focus {
background: var(--theme-focused-foreground);
outline: 0;
}

&:first-child {
padding-left: 0px;
}
}
71 changes: 71 additions & 0 deletions components/SimpleTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use client';

import styles from '@components/SimpleTable.module.css';

import * as React from 'react';

interface SimpleTableProps {
data: string[][];
headerless?: boolean;
}

const SimpleTable: React.FC<SimpleTableProps> = ({ data, headerless = false }) => {
const tableRef = React.useRef<HTMLTableElement>(null);

const handleKeyDown = (event: React.KeyboardEvent<HTMLTableElement>) => {
const activeElement = document.activeElement;
if (!activeElement) return;

switch (event.key) {
case 'ArrowUp':
case 'ArrowDown':
case 'ArrowLeft':
case 'ArrowRight':
event.preventDefault();
if (!(activeElement instanceof HTMLTableCellElement)) return;
const direction = event.key === 'ArrowUp' || event.key === 'ArrowLeft' ? 'previous' : 'next';
const allCells = Array.from(tableRef.current?.querySelectorAll<HTMLTableCellElement>('td, th') || []);
const currentIndex = allCells.indexOf(activeElement);
if (currentIndex === -1) return;
let nextIndex = direction === 'next' ? currentIndex + 1 : currentIndex - 1;
if (direction === 'previous') {
if (nextIndex < 0) nextIndex = allCells.length - 1;
} else {
if (nextIndex >= allCells.length) nextIndex = 0;
}
allCells[nextIndex].focus();
break;
}
};

return (
<table className={styles.root} ref={tableRef} onKeyDown={handleKeyDown}>
{!headerless && data.length > 0 && (
<thead className={styles.head}>
<tr className={styles.headerRow}>
{data[0].map((cellContent, colIndex) => (
<th key={colIndex} className={styles.headerCell} tabIndex={0}>
{cellContent}
</th>
))}
</tr>
</thead>
)}
<tbody className={styles.body}>
{data.slice(headerless ? 0 : 1).map((row, rowIndex) => (
<tr key={rowIndex} className={styles.row}>
{row.map((cellContent, colIndex) => (
<td key={colIndex} className={styles.cell} tabIndex={0}>
{cellContent}
</td>
))}
</tr>
))}
</tbody>
</table>
);
};

SimpleTable.displayName = 'SimpleTable';

export default SimpleTable;