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
const isBaseCase = path.length === 1; | |
if (isBaseCase) { | |
return existingRows.map((row, index) => { | |
const isMatchedRowWithoutSubRows = index === Number(id) && !row.subRows; | |
if (isMatchedRowWithoutSubRows) { | |
return { | |
...row, | |
subRows: subRowsToInsert |
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
const recursivelyUpdateTable = ({ tableData, childData, id }) => { | |
return insertIntoTable({ | |
existingRows: tableData, | |
subRowsToInsert: childData, | |
path: id.split('.') | |
}); | |
} | |
const insertIntoTable = ({ existingRows, subRowsToInsert, path }) => { | |
const id = path[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
const TableInstance = ({ tableData }) => { | |
const [columns, data] = useMemo( | |
() => { | |
const columns = [ | |
{ | |
Header: 'Topic', | |
accessor: 'name' | |
}, | |
{ | |
Header: 'Active Members', |
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
const TableQuery = () => { | |
const queryClient = useQueryClient(); | |
const [tableData, setTableData] = useState(null); | |
const { data: apiResponse, isLoading } = useQuery('discussionGroups', fetchData); | |
useEffect(() => { | |
setTableData(apiResponse?.data); | |
}, [apiResponse]) |
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
[ | |
{ | |
"id": 1, | |
"name": "How to use react-table in reporting dashboard", | |
"active": 40, | |
"status": "locked", | |
"upvotes": 30 | |
}, | |
{ | |
"id": 2, |
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
const TableLayout = ({ | |
getTableProps, | |
getTableBodyProps, | |
headerGroups, | |
rows, | |
prepareRow, | |
}) => { | |
return ( | |
<table {...getTableProps()}> | |
<thead> |
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
/* Step 5: Build additional asset files */ | |
Deno.writeTextFileSync(`${buildPath}/styles.css`, styles ? styles : ''); | |
Deno.writeTextFileSync(`${buildPath}/favicon.svg`, getFaviconSvg(favicon)); |
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
deno run --allow-read --allow-write --unstable main.ts example.md |
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
/* Step 4: Build pages into .html files with appropriate paths */ | |
for (const page of pages) { | |
const { path } = page; | |
let outputPath: string; | |
if (path === HOME_PATH) { | |
outputPath = `${buildPath}/index.html`; | |
} else { | |
outputPath = `${buildPath}${path}/index.html`; |
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
{ outputPath: "./build/index.html" } | |
{ outputPath: "./build/about/index.html" } |