-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(table): create table footer component (#864)
- Loading branch information
1 parent
f7f6318
commit aee7d22
Showing
6 changed files
with
147 additions
and
6 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ import { | |
Table, | ||
TableBody, | ||
TableCell, | ||
TableFooter, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
|
@@ -362,6 +363,97 @@ const SortableTable = () => { | |
) | ||
}`} | ||
</Code> | ||
<h3>Border variant Table with TableFooter</h3> | ||
<Table variant="border"> | ||
<TableHead> | ||
<TableRow> | ||
<TableHeader scope="col">First Name</TableHeader> | ||
<TableHeader scope="col">Last Name</TableHeader> | ||
<TableHeader scope="col">Email</TableHeader> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell>Frank</TableCell> | ||
<TableCell>Zappa</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Duane</TableCell> | ||
<TableCell>Allman</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Yamandu</TableCell> | ||
<TableCell>Costa</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Jimmy</TableCell> | ||
<TableCell>Herring</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
<TableFooter> | ||
<TableRow> | ||
<TableCell>This is a table footer.</TableCell> | ||
<TableCell>It can be used to provide additional</TableCell> | ||
<TableCell>information about the table.</TableCell> | ||
</TableRow> | ||
</TableFooter> | ||
</Table> | ||
<Code role="region" tabIndex="0"> | ||
{`import React from 'react'; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
} from '@deque/cauldron-react'; | ||
const TableBorder = () => ( | ||
<Table variant="border"> | ||
<TableHead> | ||
<TableRow> | ||
<TableHeader scope="col">First Name</TableHeader> | ||
<TableHeader scope="col">Last Name</TableHeader> | ||
<TableHeader scope="col">Email</TableHeader> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell>Frank</TableCell> | ||
<TableCell>Zappa</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Duane</TableCell> | ||
<TableCell>Allman</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Yamandu</TableCell> | ||
<TableCell>Costa</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>Jimmy</TableCell> | ||
<TableCell>Herring</TableCell> | ||
<TableCell>[email protected]</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
<TableFooter> | ||
<TableRow> | ||
<TableCell>This is a table footer.</TableCell> | ||
<TableCell>It can be used to provide additional</TableCell> | ||
<TableCell>information about the table.</TableCell> | ||
</TableRow> | ||
</TableFooter> | ||
</Table> | ||
)`} | ||
</Code> | ||
|
||
<div className="Demo-props"> | ||
<h2>Props</h2> | ||
|
@@ -417,7 +509,7 @@ const SortableTable = () => { | |
className | ||
}} | ||
/> | ||
<h3>TableHead, TableBody, TableRow, and TableCell</h3> | ||
<h3>TableHead, TableBody, TableFooter, TableRow, and TableCell</h3> | ||
<PropDocs | ||
docs={{ | ||
children, | ||
|
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,21 @@ | ||
import React, { HTMLAttributes } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
const TableFooter = ({ | ||
children, | ||
className, | ||
...other | ||
}: HTMLAttributes<HTMLTableSectionElement>) => ( | ||
<tfoot className={classNames('TableFooter', className)} {...other}> | ||
{children} | ||
</tfoot> | ||
); | ||
|
||
TableFooter.displayName = 'TableFooter'; | ||
TableFooter.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
className: PropTypes.string | ||
}; | ||
|
||
export default TableFooter; |
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