Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
22 changes: 13 additions & 9 deletions src/components/SistentNavigation/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,19 @@ export const content = [
{ id: 41, link: "/projects/sistent/components/select/guidance", text: "Select" },
{ id: 42, link: "/projects/sistent/components/select/code", text: "Select" },

{ id: 43, link: "/projects/sistent/components/text-field", text: "Text Field" },
{ id: 44, link: "/projects/sistent/components/text-field/guidance", text: "Text Field" },
{ id: 45, link: "/projects/sistent/components/text-field/code", text: "Text Field" },
{ id: 43, link: "/projects/sistent/components/table", text: "Table" },
{ id: 44, link: "/projects/sistent/components/table/guidance", text: "Table" },
{ id: 45, link: "/projects/sistent/components/table/code", text: "Table" },

{ id: 46, link: "/projects/sistent/components/text-input", text: "Text Input" },
{ id: 47, link: "/projects/sistent/components/text-input/guidance", text: "Text Input" },
{ id: 48, link: "/projects/sistent/components/text-input/code", text: "Text Input" },
{ id: 46, link: "/projects/sistent/components/text-field", text: "Text Field" },
{ id: 47, link: "/projects/sistent/components/text-field/guidance", text: "Text Field" },
{ id: 48, link: "/projects/sistent/components/text-field/code", text: "Text Field" },

{ id: 49, link: "/projects/sistent/components/tooltip", text: "Tooltip" },
{ id: 50, link: "/projects/sistent/components/tooltip/guidance", text: "Tooltip" },
{ id: 51, link: "/projects/sistent/components/tooltip/code", text: "Tooltip" },
{ id: 49, link: "/projects/sistent/components/text-input", text: "Text Input" },
{ id: 50, link: "/projects/sistent/components/text-input/guidance", text: "Text Input" },
{ id: 51, link: "/projects/sistent/components/text-input/code", text: "Text Input" },

{ id: 52, link: "/projects/sistent/components/tooltip", text: "Tooltip" },
{ id: 52, link: "/projects/sistent/components/tooltip/guidance", text: "Tooltip" },
{ id: 53, link: "/projects/sistent/components/tooltip/code", text: "Tooltip" },
];
7 changes: 7 additions & 0 deletions src/sections/Projects/Sistent/components/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ const componentsData = [
url: "/projects/sistent/components/icons",
src: "/icons"
},
{
id: 17,
name: "Table",
description: "The Table component provides structured data representation.",
url: "/projects/sistent/components/table",
src: "/table"
}
];

module.exports = { componentsData };
101 changes: 101 additions & 0 deletions src/sections/Projects/Sistent/components/table/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import React from "react";
import { navigate } from "gatsby";
import { useLocation } from "@reach/router";
import {
SistentThemeProvider,
Table,
TableBody,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use this table , we have already a component named responsive table in place use that to document. Including how columns and search are displayed as optional for tables. Checkout sistent and meshery for actual component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to ResponsiveDataTable @sudhanshutech ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TableCell,
TableContainer,
TableHead,
TableRow,
} from "@layer5/sistent";
import { SistentLayout } from "../../sistent-layout";
import { CodeBlock } from "../button/code-block";
import TabButton from "../../../../../reusecore/Button";
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode";

const codes = [
// Basic Table
`
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell>Column 1</TableCell>
<TableCell>Column 2</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Row 1</TableCell>
<TableCell>Data 1</TableCell>
</TableRow>
</TableBody>
</Table>
</TableContainer>
`
];

const TableCode = () => {
const { isDark } = useStyledDarkMode();
const location = useLocation();

return (
<SistentLayout title="Table">
<div className="content">
<a id="Identity">
<h2>Table</h2>
</a>
<p>
To use the Table component from Layer5's Sistent design system, you begin by wrapping your table inside the TableContainer, which provides scrollability and styling. Inside it, the Table acts as the root element that holds the structure. The TableHead defines the table headers using a TableRow filled with TableCell elements for each column title. The TableBody follows, containing the actual data rows. Each data row is created using a TableRow, with individual data values placed inside corresponding TableCell elements. This modular structure allows for clean, accessible, and themable table layouts that integrate seamlessly into your UI.
</p>

{/* Navigation Tabs */}
<div className="filterBtns">
<TabButton
className={location.pathname === "/projects/sistent/components/table" ? "active" : ""}
onClick={() => navigate("/projects/sistent/components/table")}
title="Overview"
/>
<TabButton
className={location.pathname === "/projects/sistent/components/table/guidance" ? "active" : ""}
onClick={() => navigate("/projects/sistent/components/table/guidance")}
title="Guidance"
/>
<TabButton
className={location.pathname === "/projects/sistent/components/table/code" ? "active" : ""}
onClick={() => navigate("/projects/sistent/components/table/code")}
title="Code"
/>
</div>

{/* Basic Table */}
<h3>Basic Table</h3>
<div className="showcase">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell>Column 1</TableCell>
<TableCell>Column 2</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Row 1</TableCell>
<TableCell>Data 1</TableCell>
</TableRow>
</TableBody>
</Table>
</TableContainer>
</SistentThemeProvider>
<CodeBlock name="basic-table" code={codes[0]} />
</div>
</div>
</SistentLayout>
);
};

export default TableCode;
116 changes: 116 additions & 0 deletions src/sections/Projects/Sistent/components/table/guidance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React from "react";
import { navigate } from "gatsby";
import { useLocation } from "@reach/router";
import {
SistentThemeProvider,
Table,
TableHead,
TableBody,
TableRow,
TableCell,
TableContainer,
} from "@layer5/sistent";
import { SistentLayout } from "../../sistent-layout";
import TabButton from "../../../../../reusecore/Button";
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode";

const TableGuidance = () => {
const location = useLocation();
const { isDark } = useStyledDarkMode();

return (
<SistentLayout title="Table">
<div className="content">
<a id="Identity">
<h2>Table</h2>
</a>
<p>
The <code>Table</code> component from the Sistent design system helps structure and display tabular data with accessibility and consistent styling in mind. It wraps MUI’s native table components to provide an enhanced and theme-friendly experience.
</p>

{/* Navigation Tabs */}
<div className="filterBtns">
<TabButton
className={location.pathname === "/projects/sistent/components/table" ? "active" : ""}
onClick={() => navigate("/projects/sistent/components/table")}
title="Overview"
/>
<TabButton
className={location.pathname === "/projects/sistent/components/table/guidance" ? "active" : ""}
onClick={() => navigate("/projects/sistent/components/table/guidance")}
title="Guidance"
/>
<TabButton
className={location.pathname === "/projects/sistent/components/table/code" ? "active" : ""}
onClick={() => navigate("/projects/sistent/components/table/code")}
title="Code"
/>
</div>

<div className="main-content">
<a id="BasicTable">
<h2>How to Use</h2>
</a>

<p>Here’s a breakdown of each component used to construct a table:</p>

<ul>
<li>
<strong>TableContainer</strong>: Acts as a wrapper around the entire table. Useful for scrollability and border rounding.
</li>
<li>
<strong>Table</strong>: The root element that holds all rows and columns.
</li>
<li>
<strong>TableHead</strong>: Defines the header section of the table. Usually contains one <code>TableRow</code> with multiple <code>TableCell</code> elements as headers.
</li>
<li>
<strong>TableBody</strong>: Wraps all the dynamic content (rows of data). It follows the <code>TableHead</code>.
</li>
<li>
<strong>TableRow</strong>: Represents a single row inside either the head or body. It holds <code>TableCell</code> components.
</li>
<li>
<strong>TableCell</strong>: The actual data cell. Used inside both <code>TableRow</code> in the head and body.
</li>
</ul>

<p>Below is a simple example of how these components come together:</p>

<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<TableContainer className="overflow-x-auto shadow rounded border border-gray-200 my-6">
<Table>
<TableHead>
<TableRow>
<TableCell>Name</TableCell>
<TableCell>Age</TableCell>
<TableCell>City</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>John Doe</TableCell>
<TableCell>28</TableCell>
<TableCell>New York</TableCell>
</TableRow>
<TableRow>
<TableCell>Jane Smith</TableCell>
<TableCell>34</TableCell>
<TableCell>London</TableCell>
</TableRow>
</TableBody>
</Table>
</TableContainer>
</SistentThemeProvider>

<p>
You can customize the layout by applying conditional styles, using responsive wrappers,
or enhancing interactivity with row click handlers, sort functionality, etc.
</p>
</div>
</div>
</SistentLayout>
);
};

export default TableGuidance;
108 changes: 108 additions & 0 deletions src/sections/Projects/Sistent/components/table/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import React from "react";
import { navigate } from "gatsby";
import { useLocation } from "@reach/router";
import {
Table,
TableHead,
TableBody,
TableRow,
TableCell,
TableContainer,
SistentThemeProvider,
} from "@layer5/sistent";
import TabButton from "../../../../../reusecore/Button";
import { SistentLayout } from "../../sistent-layout";
import { Row } from "../../../../../reusecore/Layout";
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode";

// Sample table data
const tableData = [
{ id: 1, name: "John Doe", age: 25, role: "Developer" },
{ id: 2, name: "Jane Smith", age: 28, role: "Designer" },
{ id: 3, name: "Sam Wilson", age: 30, role: "Manager" },
];

const SistentTable = () => {
const location = useLocation();
const { isDark } = useStyledDarkMode();

return (
<SistentLayout title="Table">
<div className="content">
<a id="Identity">
<h2>Table</h2>
</a>

{/* 🔰 Introduction to Sistent Table */}
<p>
The <code>Table</code> component in the Sistent design system is a wrapper
around MUI’s Table components, offering consistent styling and structure
aligned with Layer5’s UI philosophy. It helps developers display structured
data in a clean, responsive, and accessible way with minimal effort.
</p>

{/* Navigation Tabs */}
<div className="filterBtns">
<TabButton
className={
location.pathname === "/projects/sistent/components/table" ? "active" : ""
}
onClick={() => navigate("/projects/sistent/components/table")}
title="Overview"
/>
<TabButton
className={
location.pathname === "/projects/sistent/components/table/guidance" ? "active" : ""
}
onClick={() => navigate("/projects/sistent/components/table/guidance")}
title="Guidance"
/>
<TabButton
className={
location.pathname === "/projects/sistent/components/table/code" ? "active" : ""
}
onClick={() => navigate("/projects/sistent/components/table/code")}
title="Code"
/>
</div>

{/* Basic Table */}
<div className="main-content">
<a id="Basic Usage">
<h2>Basic Usage</h2>
</a>
<p>A simple table displaying structured data with column headers and rows.</p>

<Row $Hcenter className="image-container">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<TableContainer className="border border-gray-200 rounded shadow-md overflow-auto">
<Table>
<TableHead>
<TableRow>
<TableCell>ID</TableCell>
<TableCell>Name</TableCell>
<TableCell>Age</TableCell>
<TableCell>Role</TableCell>
</TableRow>
</TableHead>
<TableBody>
{tableData.map((row) => (
<TableRow key={row.id}>
<TableCell>{row.id}</TableCell>
<TableCell>{row.name}</TableCell>
<TableCell>{row.age}</TableCell>
<TableCell>{row.role}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</SistentThemeProvider>
</Row>
</div>
</div>
</SistentLayout>
);
};

export default SistentTable;
Loading