-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
252 additions
and
9 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,42 @@ | ||
import { useTable } from 'react-table'; | ||
import styles from './Meetings.module.scss'; | ||
|
||
const Meetings = ({ columns, data }) => { | ||
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = | ||
useTable({ | ||
columns, | ||
data, | ||
}); | ||
|
||
return ( | ||
<div className={styles.table}> | ||
<table {...getTableProps()}> | ||
<thead> | ||
{headerGroups.map((headerGroup) => ( | ||
<tr {...headerGroup.getHeaderGroupProps()}> | ||
{headerGroup.headers.map((column) => ( | ||
<th {...column.getHeaderProps()}>{column.render('Header')}</th> | ||
))} | ||
</tr> | ||
))} | ||
</thead> | ||
<tbody {...getTableBodyProps()}> | ||
{rows.map((row, i) => { | ||
prepareRow(row); | ||
return ( | ||
<tr {...row.getRowProps()}> | ||
{row.cells.map((cell) => { | ||
return ( | ||
<td {...cell.getCellProps()}>{cell.render('Cell')}</td> | ||
); | ||
})} | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Meetings; |
27 changes: 27 additions & 0 deletions
27
src/app/views/meetings/components/meetings/Meetings.module.scss
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,27 @@ | ||
.table { | ||
background-color: var(--header); | ||
table { | ||
border-spacing: 0; | ||
border: 1px solid var(--border); | ||
|
||
tr { | ||
:last-child { | ||
td { | ||
border-bottom: 0; | ||
} | ||
} | ||
} | ||
|
||
th, | ||
td { | ||
margin: 0; | ||
padding: 0.5rem; | ||
border-bottom: 1px solid var(--border); | ||
border-right: 1px solid var(--border); | ||
|
||
:last-child { | ||
border-right: 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
File renamed without changes.
File renamed without changes.
122 changes: 122 additions & 0 deletions
122
src/app/views/meetings/containers/meetingsManagement/table.js
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,122 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { useTable } from 'react-table'; | ||
|
||
import makeData from './makeData'; | ||
|
||
const Styles = styled.div` | ||
padding: 1rem; | ||
table { | ||
border-spacing: 0; | ||
border: 1px solid black; | ||
tr { | ||
:last-child { | ||
td { | ||
border-bottom: 0; | ||
} | ||
} | ||
} | ||
th, | ||
td { | ||
margin: 0; | ||
padding: 0.5rem; | ||
border-bottom: 1px solid black; | ||
border-right: 1px solid black; | ||
:last-child { | ||
border-right: 0; | ||
} | ||
} | ||
} | ||
`; | ||
|
||
function Table({ columns, data }) { | ||
// Use the state and functions returned from useTable to build your UI | ||
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = | ||
useTable({ | ||
columns, | ||
data, | ||
}); | ||
|
||
// Render the UI for your table | ||
return ( | ||
<table {...getTableProps()}> | ||
<thead> | ||
{headerGroups.map((headerGroup) => ( | ||
<tr {...headerGroup.getHeaderGroupProps()}> | ||
{headerGroup.headers.map((column) => ( | ||
<th {...column.getHeaderProps()}>{column.render('Header')}</th> | ||
))} | ||
</tr> | ||
))} | ||
</thead> | ||
<tbody {...getTableBodyProps()}> | ||
{rows.map((row, i) => { | ||
prepareRow(row); | ||
return ( | ||
<tr {...row.getRowProps()}> | ||
{row.cells.map((cell) => { | ||
return <td {...cell.getCellProps()}>{cell.render('Cell')}</td>; | ||
})} | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
); | ||
} | ||
|
||
function App() { | ||
const columns = React.useMemo( | ||
() => [ | ||
{ | ||
Header: 'Name', | ||
columns: [ | ||
{ | ||
Header: 'First Name', | ||
accessor: 'firstName', | ||
}, | ||
{ | ||
Header: 'Last Name', | ||
accessor: 'lastName', | ||
}, | ||
], | ||
}, | ||
{ | ||
Header: 'Info', | ||
columns: [ | ||
{ | ||
Header: 'Age', | ||
accessor: 'age', | ||
}, | ||
{ | ||
Header: 'Visits', | ||
accessor: 'visits', | ||
}, | ||
{ | ||
Header: 'Status', | ||
accessor: 'status', | ||
}, | ||
{ | ||
Header: 'Profile Progress', | ||
accessor: 'progress', | ||
}, | ||
], | ||
}, | ||
], | ||
[] | ||
); | ||
|
||
const data = React.useMemo(() => makeData(20), []); | ||
|
||
return ( | ||
<Styles> | ||
<Table columns={columns} data={data} /> | ||
</Styles> | ||
); | ||
} | ||
|
||
export default App; |
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