-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Table): Add components for tables (Table, Head, Row, Cell)
Four new simple components for creating nice tables. These components have only style, and as such you should create your own component which holds state. The components are: Table - no props - wraps all other table components Head - first child of Table, contains column headings as Cells - no props Row - The active prop will highlight a row. Cell - The active prop will underline Cell text and change pointer. Use this with a clickable cell
- Loading branch information
Ilari Sinkkonen
committed
Jun 8, 2017
1 parent
430ed02
commit f23747c
Showing
2 changed files
with
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import styled from 'styled-components'; | ||
|
||
import colorGetter from './colorGetter'; | ||
import { Layout, Box } from './Layout'; | ||
|
||
export const Table = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 16px; | ||
`; | ||
export const Row = styled(Layout)` | ||
font-size: 0.9rem; | ||
${props => props.active && | ||
`background-color: ${colorGetter(props, 'primaryColorLightest')};`} | ||
&:nth-child(odd) { | ||
background-color: ${props => colorGetter(props, 'greyLightest')}; | ||
${props => props.active && | ||
`background-color: ${colorGetter(props, 'primaryColorLightest')};`} | ||
} | ||
`; | ||
export const Head = styled(Layout)` | ||
border-bottom: 1px solid ${props => colorGetter(props, 'greyLight')}; | ||
font-size: 0.9rem; | ||
color: ${props => colorGetter(props, 'primaryColor')}; | ||
`; | ||
export const Cell = styled(Box)` | ||
padding: 16px 8px; | ||
${props => props.active && 'text-decoration: underline;'} | ||
${props => props.active && 'cursor: pointer;'} | ||
`; |
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