-
-
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
prop to Column component
- Loading branch information
1 parent
cac2c08
commit 03a041b
Showing
5 changed files
with
80 additions
and
0 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
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 |
---|---|---|
|
@@ -136,3 +136,69 @@ const StatusBadge = ({ value }) => <Badge label={value} variant="lightest" style | |
</Table> | ||
</div> | ||
``` | ||
|
||
# Column header alignment | ||
##### It is possible to align the content of each column header using the `headerAlignment` prop. Valid values are `left` (default), `center` and `right`. | ||
|
||
```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', | ||
company: 'Nexxtway', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Jose Torres', | ||
company: 'Google', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Reinier', | ||
company: 'Nexxtway', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Sara', | ||
company: 'Nexxtway', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
{ | ||
name: 'Tahimi', | ||
company: 'Nexxtway', | ||
email: '[email protected]', | ||
status: 'verified', | ||
}, | ||
]; | ||
|
||
const badgeStyles = { color: '#1de9b6' }; | ||
|
||
const StatusBadge = ({ value }) => <Badge label={value} variant="lightest" style={badgeStyles} />; | ||
|
||
<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"> | ||
<Column header="Name" field="name" headerAlignment="center" /> | ||
<Column header="Status" field="status" component={StatusBadge} headerAlignment="center" /> | ||
<Column header="Company" field="company" headerAlignment="center" /> | ||
<Column header="Email" field="email" headerAlignment="center" /> | ||
</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