add test data and table styles

pull/26459/head^2
Corwin Smith 2 years ago
parent 5153ea7f07
commit ac622c103d
  1. 51
      src/components/UI/DataTable.tsx
  2. 32
      src/components/UI/downloads/DownloadsTable.tsx
  3. 98
      src/data/test/download-testdata.ts
  4. 7
      src/pages/downloads.tsx

@ -5,20 +5,39 @@ import {
Th, Th,
TableContainer, TableContainer,
Text, Text,
Tbody,
Td,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { FC } from 'react'; import { FC } from 'react';
interface Props { interface Props {
columnHeaders: string[] columnHeaders: string[]
data: any
} }
export const DataTable: FC<Props> = ({ export const DataTable: FC<Props> = ({
columnHeaders columnHeaders,
data,
}) => { }) => {
return ( return (
<TableContainer> <TableContainer
<Table variant='unstyled'> css={{
<Thead> "&::-webkit-scrollbar": {
background: "#d7f5ef",
borderTop: '2px solid #11866f',
height: 18
},
"&::-webkit-scrollbar-thumb": {
background: "#11866f",
},
}}
p={4}
>
<Table
variant='unstyled'
>
<Thead
>
<Tr> <Tr>
{ {
columnHeaders.map((columnHeader, idx) => { columnHeaders.map((columnHeader, idx) => {
@ -43,6 +62,30 @@ export const DataTable: FC<Props> = ({
} }
</Tr> </Tr>
</Thead> </Thead>
<Tbody>
{
data.map((item: any, idx: number) => {
return (
<Tr
key={idx}
>
{
columnHeaders.map((columnHeader, idx) => {
return (
<Td
key={idx}
px={0}
>
{item[columnHeader.toLowerCase()]}
</Td>
)
})
}
</Tr>
)
})
}
</Tbody>
</Table> </Table>
</TableContainer> </TableContainer>
) )

@ -10,6 +10,8 @@ import {
import { DataTable } from '../DataTable' import { DataTable } from '../DataTable'
import { testDownloadData } from '../../../data/test/download-testdata'
export const DownloadsTable = () => { export const DownloadsTable = () => {
return ( return (
<Stack sx={{ mt: '0 !important' }} borderBottom='2px solid #11866f'> <Stack sx={{ mt: '0 !important' }} borderBottom='2px solid #11866f'>
@ -120,59 +122,69 @@ export const DownloadsTable = () => {
</Tab> </Tab>
</TabList> </TabList>
<TabPanels> <TabPanels>
<TabPanel> <TabPanel p={0}>
<DataTable <DataTable
columnHeaders={[ columnHeaders={[
'Release', 'Release',
'Commit', 'Commit',
'Kind', 'Kind',
'Arch', 'Arch',
'Size' 'Size',
'Published'
]} ]}
data={testDownloadData}
/> />
</TabPanel> </TabPanel>
<TabPanel> <TabPanel p={0}>
<DataTable <DataTable
columnHeaders={[ columnHeaders={[
'Release', 'Release',
'Commit', 'Commit',
'Kind', 'Kind',
'Arch', 'Arch',
'Size' 'Size',
'Published'
]} ]}
data={testDownloadData}
/> />
</TabPanel> </TabPanel>
<TabPanel> <TabPanel p={0}>
<DataTable <DataTable
columnHeaders={[ columnHeaders={[
'Release', 'Release',
'Commit', 'Commit',
'Kind', 'Kind',
'Arch', 'Arch',
'Size' 'Size',
'Published'
]} ]}
data={testDownloadData}
/> />
</TabPanel> </TabPanel>
<TabPanel> <TabPanel p={0}>
<DataTable <DataTable
columnHeaders={[ columnHeaders={[
'Release', 'Release',
'Commit', 'Commit',
'Kind', 'Kind',
'Arch', 'Arch',
'Size' 'Size',
'Published'
]} ]}
data={testDownloadData}
/> />
</TabPanel> </TabPanel>
<TabPanel> <TabPanel p={0}>
<DataTable <DataTable
columnHeaders={[ columnHeaders={[
'Release', 'Release',
'Commit', 'Commit',
'Kind', 'Kind',
'Arch', 'Arch',
'Size' 'Size',
'Published'
]} ]}
data={testDownloadData}
/> />
</TabPanel> </TabPanel>
</TabPanels> </TabPanels>

@ -0,0 +1,98 @@
export const testDownloadData = [
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
{
release: 'Geth 1.10.23',
commit: 'd901d853…',
kind: 'archive',
arch: '64-bit',
size: '11.71 MB',
published: 'Last Wednesday at 11:11 AM'
},
]

@ -4,9 +4,6 @@ import {
Link, Link,
ListItem, ListItem,
Stack, Stack,
Table,
Th,
Tr,
Text, Text,
UnorderedList, UnorderedList,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
@ -200,7 +197,7 @@ const DownloadsPage: NextPage = ({}) => {
</Text> </Text>
</Stack> </Stack>
<Stack p={4}> {/* <Stack p={4}>
<DataTable <DataTable
columnHeaders={[ columnHeaders={[
'Build Server', 'Build Server',
@ -209,7 +206,7 @@ const DownloadsPage: NextPage = ({}) => {
'Fingerprint' 'Fingerprint'
]} ]}
/> />
</Stack> </Stack> */}
</DownloadsSection> </DownloadsSection>
<DownloadsSection sectionTitle='Importing keys and verifying builds'> <DownloadsSection sectionTitle='Importing keys and verifying builds'>

Loading…
Cancel
Save