-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
headerAlignment
to Table listview variant
- Loading branch information
1 parent
4d05523
commit d9343bc
Showing
7 changed files
with
96 additions
and
25 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 |
---|---|---|
|
@@ -202,3 +202,69 @@ const StatusBadge = ({ value }) => <div style={{ display: 'flex', justifyContent | |
</Table> | ||
</div> | ||
``` | ||
|
||
# Column header alignment with `listview` variant | ||
##### When table is variant `listview` the default column header alignment is center, but you can still provide a custom alignment. | ||
|
||
```js | ||
import React from 'react'; | ||
import { Table, Column, ButtonGroup, ButtonIcon, Badge } from 'react-rainbow-components'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faCog, faEllipsisV } from '@fortawesome/free-solid-svg-icons'; | ||
|
||
const data = [ | ||
{ | ||
name: 'Leandro Torres', | ||
payment: '10.00 USD', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Jose Torres', | ||
payment: '1.00 USD', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Reinier', | ||
payment: '5.00 USD', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Sara', | ||
payment: '321.00 USD', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Tahimi', | ||
payment: '8.00 USD', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
]; | ||
|
||
const badgeStyles = { color: '#1de9b6' }; | ||
|
||
const StatusBadge = ({ value }) => <div style={{ display: 'flex', justifyContent: 'center', marginTop: 7 }}><Badge label={value} variant="lightest" style={badgeStyles} /></div>; | ||
|
||
<div className="rainbow-p-bottom_xx-large"> | ||
<GlobalHeader className="rainbow-m-bottom_xx-large" src="images/user/user3.jpg"> | ||
<ButtonGroup className="rainbow-m-right_medium"> | ||
<ButtonIcon variant="border-filled" disabled icon={<FontAwesomeIcon icon={faCog} />} /> | ||
<ButtonIcon | ||
variant="border-filled" | ||
disabled | ||
icon={<FontAwesomeIcon icon={faEllipsisV} />} | ||
/> | ||
</ButtonGroup> | ||
</GlobalHeader> | ||
<Table data={data} keyField="name" variant="listview"> | ||
<Column header="Name" field="name" headerAlignment="left" /> | ||
<Column header="Email" field="email" /> | ||
<Column header="Status" field="status" component={StatusBadge} /> | ||
<Column header="Payment" field="payment" headerAlignment="right" cellAlignment="right" /> | ||
</Table> | ||
</div> | ||
``` |
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
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