-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#80): adding the table on Code content
- Loading branch information
1 parent
34b89d1
commit 7055fba
Showing
12 changed files
with
149 additions
and
12 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
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,2 @@ | ||
changelog: https://github.com/WestpacGEL/GEL-next/bloc/main/CHANGELOG.ms | ||
currentVersion: 1.0.0 |
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
103 changes: 103 additions & 0 deletions
103
...[...component]/components/content-tabs/components/code-content/code-content.component.tsx
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,103 @@ | ||
'use client'; | ||
|
||
import { DocumentRenderer } from '@keystatic/core/renderer'; | ||
import { Button, Container, Grid, Item, Link, Table } from '@westpac/ui'; | ||
import { NewWindowIcon } from '@westpac/ui/icon'; | ||
|
||
import { Code } from '@/components/content-blocks/typography'; | ||
import { Heading } from '@/components/document-renderer'; | ||
|
||
import { DOCUMENT_RENDERERS } from '../document-renderer'; | ||
import { TableOfContents } from '../intro/components'; | ||
|
||
import { type CodeContentProps } from '.'; | ||
|
||
export function CodeContent({ content, westpacUIInfo }: CodeContentProps) { | ||
return ( | ||
<> | ||
<section className="py-7 sm:pb-10 sm:pt-15"> | ||
<Container> | ||
<Grid> | ||
<Item span={{ initial: 12, sm: 7 }}> | ||
<table className="table w-full bg-[#f2f8fc] text-info"> | ||
<tbody> | ||
<tr> | ||
<th className="w-10 border-y border-gel-icon p-3 text-left font-semibold">Version</th> | ||
<td className="border-y border-gel-icon p-3">{westpacUIInfo?.currentVersion}</td> | ||
</tr> | ||
<tr> | ||
<th className="w-10 border-y border-gel-icon p-3 text-left font-semibold">History</th> | ||
<td className="border-y border-gel-icon p-3"> | ||
<Button | ||
tag="a" | ||
size="small" | ||
className="pl-0" | ||
look="link" | ||
target="_blank" | ||
href={westpacUIInfo?.changelog || '#'} | ||
> | ||
<div className="flex items-center gap-1"> | ||
<span>View changes</span> | ||
<NewWindowIcon size="xsmall" /> | ||
</div> | ||
</Button> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th className="w-10 border-y border-gel-icon p-3 text-left font-semibold">Install</th> | ||
<td className="border-y border-gel-icon p-3 text-black"> | ||
<Code>npm install @westpac/ui</Code> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th className="w-10 border-y border-gel-icon p-3 text-left font-semibold">Requires</th> | ||
<td className="border-y border-gel-icon p-3">react@18</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</Item> | ||
<Item span={{ initial: 12, sm: 4 }} start={{ initial: 1, sm: 9 }}> | ||
<TableOfContents contents={[{ title: 'test' }]} /> | ||
</Item> | ||
</Grid> | ||
</Container> | ||
</section> | ||
<Container className="py-15"> | ||
<DocumentRenderer document={content} renderers={DOCUMENT_RENDERERS} componentBlocks={{}} /> | ||
</Container> | ||
<section className="bg-white py-7 sm:pb-10 sm:pt-15"> | ||
<Container> | ||
<Heading level={2}>Props</Heading> | ||
<Table bordered striped className="table w-full"> | ||
<Table.Caption className="text-left">Alert props</Table.Caption> | ||
<Table.Header> | ||
<Table.Row> | ||
{['Property', 'Type', 'Value', 'Default', 'Required', 'Description'].map(title => ( | ||
<Table.HeaderCell key={title} className="text-left"> | ||
{title} | ||
</Table.HeaderCell> | ||
))} | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
<Table.Row> | ||
{['Property', 'Type', 'Value', 'Default', 'Required', 'Description'].map(title => ( | ||
<Table.Cell key={title} className="text-left"> | ||
{title} | ||
</Table.Cell> | ||
))} | ||
</Table.Row> | ||
<Table.Row> | ||
{['Property', 'Type', 'Value', 'Default', 'Required', 'Description'].map(title => ( | ||
<Table.Cell key={title} className="text-left"> | ||
{title} | ||
</Table.Cell> | ||
))} | ||
</Table.Row> | ||
</Table.Body> | ||
</Table> | ||
</Container> | ||
</section> | ||
</> | ||
); | ||
} |
13 changes: 13 additions & 0 deletions
13
...stem/[...component]/components/content-tabs/components/code-content/code-content.types.ts
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,13 @@ | ||
import { DocumentElement } from '@keystatic/core'; | ||
|
||
import { RelatedInfoProps } from '@/components/related-info/related-info.types'; | ||
import { WestpacUIInfo } from '@/types/westpac-ui-info.types'; | ||
|
||
export type CodeSectionProps = { content: DocumentElement[]; title: string }; | ||
|
||
export type CodeContentProps = { | ||
content: DocumentElement[]; | ||
description?: string; | ||
relatedComponents?: RelatedInfoProps['relatedComponents']; | ||
westpacUIInfo?: WestpacUIInfo; | ||
}; |
2 changes: 2 additions & 0 deletions
2
...app/design-system/[...component]/components/content-tabs/components/code-content/index.ts
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,2 @@ | ||
export { CodeContent } from './code-content.component'; | ||
export { type CodeContentProps } from './code-content.types'; |
1 change: 1 addition & 0 deletions
1
apps/site/src/app/design-system/[...component]/components/content-tabs/components/index.ts
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './accessibility-content'; | ||
export * from './code-content'; | ||
export * from './design-content'; | ||
export * from './intro'; | ||
export * from './tabs'; |
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,4 @@ | ||
export type WestpacUIInfo = { | ||
changelog: string | null; | ||
currentVersion: string; | ||
}; |