-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This new libfuncs page shows a table of Sierra libfuncs from markdown files stored in `docs/libfuncs`.
- Loading branch information
Rémy Baranx
committed
Feb 27, 2024
1 parent
4d6b01b
commit 2e307d7
Showing
142 changed files
with
1,483 additions
and
107 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,51 @@ | ||
import cn from 'classnames' | ||
import { MDXRemote } from 'next-mdx-remote' | ||
|
||
import { GITHUB_REPO_URL } from 'util/constants' | ||
|
||
import { Button } from 'components/ui' | ||
import * as Doc from 'components/ui/Doc' | ||
|
||
const docComponents = { | ||
h1: Doc.H1, | ||
h2: Doc.H2, | ||
h3: Doc.H3, | ||
p: Doc.P, | ||
ul: Doc.UL, | ||
ol: Doc.OL, | ||
li: Doc.LI, | ||
table: Doc.Table, | ||
th: Doc.TH, | ||
td: Doc.TD, | ||
a: Doc.A, | ||
pre: Doc.Pre, | ||
} | ||
|
||
const DocRowDetail = ({ mdxContent }: { mdxContent: any }) => { | ||
return ( | ||
<div | ||
className={cn('text-sm px-4 md:px-8 py-8 ', { | ||
'bg-indigo-50 dark:bg-black-600': mdxContent, | ||
'bg-orange-50 dark:bg-gray-800': !mdxContent, | ||
})} | ||
> | ||
<div> | ||
{mdxContent ? ( | ||
<MDXRemote {...mdxContent} components={docComponents} /> | ||
) : ( | ||
<div className="flex flex-row justify-between items-center"> | ||
<div> | ||
This function is not yet documented. Feel free to help us | ||
documenting it ! | ||
</div> | ||
<Button size="xs" external href={GITHUB_REPO_URL}> | ||
Contribute on GitHub | ||
</Button> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default DocRowDetail |
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,70 @@ | ||
import { Row } from 'react-table' | ||
|
||
import { StackBox } from 'components/ui' | ||
|
||
type TableRow = Row<Record<string, string | undefined>> | ||
|
||
const filter = (rows: TableRow[], id: string, filterValue: string) => { | ||
return rows.filter((row) => | ||
row.original[id] | ||
?.toLocaleLowerCase() | ||
.includes(filterValue.toLocaleLowerCase()), | ||
) | ||
} | ||
|
||
const filterDescription = ( | ||
rows: TableRow[], | ||
id: string, | ||
filterValue: string, | ||
) => { | ||
return rows.filter((row) => | ||
(row.original[id] || '-') | ||
?.toLocaleLowerCase() | ||
.includes(filterValue.toLocaleLowerCase()), | ||
) | ||
} | ||
|
||
const refsRenderer = ({ value }: { value: string }) => | ||
value ? ( | ||
<StackBox | ||
value={value} | ||
className="text-xs border-indigo-300 dark:border-indigo-900 text-gray-800 dark:text-gray-200" | ||
/> | ||
) : ( | ||
'-' | ||
) | ||
|
||
const columns = [ | ||
{ | ||
id: 'name', | ||
Header: 'Name', | ||
accessor: 'name', | ||
filter, | ||
}, | ||
{ | ||
id: 'invokeRefs', | ||
Header: 'Invoke Refs', | ||
accessor: 'invokeRefs', | ||
Cell: refsRenderer, | ||
}, | ||
{ | ||
id: 'resultRefs', | ||
Header: 'Result Refs', | ||
accessor: 'resultRefs', | ||
Cell: refsRenderer, | ||
}, | ||
{ | ||
id: 'outputRefs', | ||
Header: 'Output Refs', | ||
accessor: 'outputRefs', | ||
Cell: refsRenderer, | ||
}, | ||
{ | ||
id: 'shortDescription', | ||
Header: 'Short Description', | ||
accessor: (row: any) => (row.shortDescription ? row.shortDescription : '-'), | ||
filterDescription, | ||
}, | ||
] | ||
|
||
export default columns |
Oops, something went wrong.