-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add Table to Docs, align colours [MDS-725] (#2459)
* fix: add Pagination to Docs, align colours [MDS-724] * fix: add Pagination to Docs, align colours [MDS-724] * fix: add Table to Docs, align colours [MDS-725]
- Loading branch information
Showing
10 changed files
with
102 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A component for displaying large amounts of data in rows and columns. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Table from '@heathmont/moon-base-tw/lib/table/Table'; | ||
|
||
export const Default = () => ( | ||
<Table> | ||
<Table.Head> | ||
<Table.Row> | ||
<Table.Header>Header 1</Table.Header> | ||
<Table.Header>Header 2</Table.Header> | ||
<Table.Header>Header 3</Table.Header> | ||
</Table.Row> | ||
</Table.Head> | ||
<Table.Body> | ||
<Table.Row> | ||
<Table.Cell>Cell 1</Table.Cell> | ||
<Table.Cell>Cell 2</Table.Cell> | ||
<Table.Cell>Cell 3</Table.Cell> | ||
</Table.Row> | ||
<Table.Row> | ||
<Table.Cell>Cell 1</Table.Cell> | ||
<Table.Cell>Cell 2</Table.Cell> | ||
<Table.Cell>Cell 3</Table.Cell> | ||
</Table.Row> | ||
</Table.Body> | ||
</Table> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Default } from '@/app/components/server/table/examples/Default'; | ||
import ExampleSection from '@/app/components/shared/ExampleSection'; | ||
import QuickNav from '@/app/components/shared/QuickNav'; | ||
import { getExamples } from '@/app/utils/getExamples'; | ||
import { MDX } from '@/components/MDX'; | ||
|
||
export default async function Table() { | ||
const { server } = await getExamples(); | ||
const examplesList = Object.keys(server.table.examples); | ||
return ( | ||
<div className="w-full max-w-7xl flex flex-col gap-4 text-moon-14"> | ||
<h1 className="font-medium text-moon-32">Table</h1> | ||
<MDX markdown={server.table.description} /> | ||
<QuickNav items={examplesList} /> | ||
<ExampleSection | ||
title="Default" | ||
component={<Default />} | ||
code={server.table.examples.Default} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type Props = { | ||
className?: string; | ||
children?: React.ReactNode; | ||
}; | ||
|
||
export default Props; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; | ||
|
||
export default Size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type Props from './Props'; | ||
import type Size from './Size'; | ||
|
||
type TableProps = Props & { | ||
size?: Size; | ||
}; | ||
|
||
export default TableProps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type Size from '../types/Size'; | ||
|
||
const getSize = (size?: Size) => { | ||
switch (size) { | ||
case 'xs': | ||
return '[&_td]:px-2 [&_td]:py-1 [&_td]:text-moon-12 [&_th]:px-2 [&_th]:py-1 [&_th]:text-moon-12'; | ||
case 'sm': | ||
return '[&_td]:px-3 [&_td]:py-1 [&_td]:text-moon-14 [&_th]:px-3 [&_th]:py-1 [&_th]:text-moon-14'; | ||
case 'lg': | ||
return '[&_td]:px-3 [&_td]:py-3 [&_td]:text-moon-14 [&_th]:px-3 [&_th]:py-3 [&_th]:text-moon-14'; | ||
case 'xl': | ||
return '[&_td]:px-3 [&_td]:py-4 [&_td]:text-moon-14 [&_th]:px-3 [&_th]:py-4 [&_th]:text-moon-14'; | ||
case '2xl': | ||
return '[&_td]:px-3 [&_td]:py-5 [&_td]:text-moon-14 [&_th]:px-3 [&_th]:py-5 [&_th]:text-moon-14'; | ||
case 'md': | ||
default: | ||
return '[&_td]:px-3 [&_td]:py-2 [&_td]:text-moon-14 [&_th]:px-3 [&_th]:py-2 [&_th]:text-moon-14'; | ||
} | ||
}; | ||
|
||
export default getSize; |