This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(md-data-table): Add data-table style hooks
* Add styles for th during column sorting * Limit size of check-box column * Add css names that can be used independent of component * Add SASS vars for potential customiztion & theming * Tighten adherence to MD table spec spacing/sizing
- Loading branch information
samuel.jones
committed
Apr 5, 2016
1 parent
67e8054
commit f1f3c68
Showing
3 changed files
with
108 additions
and
15 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 |
---|---|---|
@@ -1,44 +1,133 @@ | ||
@import "../../core/style/variables"; | ||
@import "../../core/style/default-theme"; | ||
|
||
md-data-table { | ||
$data-table-font-size: rem(1.3) !default; | ||
$data-table-header-font-size: rem(1.2) !default; | ||
$data-table-header-sort-icon-size: rem(1.6) !default; | ||
|
||
//TODO (ollwenjones) somewhere support dark themeing for these colors? | ||
$data-table-header-sorted-icon-hover-color: rgba(#000, 0.38) !default; | ||
$data-table-divider-color: rgba(#000, 0.12) !default; | ||
$first-last-cell-padding: rem(2.4) !default; | ||
$check-cell-width: rem(1.8) !default; | ||
|
||
$data-table-hover-color: md-color($md-grey, 200) !default; | ||
$data-table-selection-color: md-color($md-grey, 100) !default; | ||
|
||
$data-table-dividers: 1px solid $data-table-divider-color !default; | ||
|
||
$data-table-row-height: rem(4.800) !default; | ||
$data-table-last-row-height: rem(5.600) !default; | ||
$data-table-column-padding: rem(2.400) !default; | ||
$data-table-column-spacing: rem(3.200) !default; | ||
//column spacing + column padding = the prescribed 56dp | ||
|
||
md-data-table, .md-data-table { | ||
display: table; | ||
border-spacing: 0; | ||
border-collapse: collapse; | ||
font-size: $data-table-font-size; | ||
|
||
box-sizing: border-box; | ||
width: 100%; | ||
|
||
md-checkbox { | ||
margin: 0; | ||
width: $check-cell-width; | ||
vertical-align: middle; | ||
} | ||
tr { | ||
vertical-align: top; | ||
vertical-align: middle; | ||
&:last-child { | ||
height: $data-table-last-row-height; | ||
} | ||
} | ||
th, td { | ||
padding: 0 $data-table-column-spacing 0 $data-table-column-padding; | ||
text-align: right; | ||
|
||
&:first-of-type { | ||
padding-left: $first-last-cell-padding; | ||
} | ||
|
||
&:last-of-type { | ||
padding-right: $first-last-cell-padding; | ||
} | ||
|
||
&.md-text-cell { text-align: left; } | ||
|
||
&.md-data-check-cell { | ||
padding: 0 0 0 $data-table-column-padding; | ||
width: $check-cell-width; | ||
} | ||
} | ||
th { | ||
padding: 22px 12px; | ||
font-size: 12px; | ||
font-size: $data-table-header-font-size; | ||
font-weight: 600; | ||
color: md-color($md-foreground, secondary-text); | ||
text-overflow: ellipsis; | ||
box-sizing: border-box; | ||
|
||
&.sortable { | ||
cursor: pointer; | ||
} | ||
|
||
/* | ||
TODO (ollwenjones) sorting functionality pending, but these class names | ||
were tested, and can be used outside of the library component structures. | ||
*/ | ||
&.sorted-ascending, | ||
&.sorted-descending { | ||
color: md-color($md-foreground, text); | ||
&:before { | ||
font-family: 'Material Icons'; | ||
font-size: $data-table-header-sort-icon-size; | ||
content: "\e5d8"; | ||
margin-right: 5px; | ||
vertical-align: sub; | ||
} | ||
&:hover { | ||
cursor: pointer; | ||
&:before { | ||
color: $data-table-header-sorted-icon-hover-color; | ||
} | ||
} | ||
} | ||
&.sorted-descending:before { | ||
content: "\e5db"; | ||
} | ||
} | ||
td { | ||
border-top: 1px solid md-color($md-foreground, divider); | ||
padding: 14px 12px; | ||
font-size: 13px; | ||
position: relative; | ||
vertical-align: middle; | ||
height: $data-table-row-height; | ||
border-top: $data-table-dividers; | ||
border-bottom: $data-table-dividers; | ||
box-sizing: border-box; | ||
color: md-color($md-foreground, text); | ||
} | ||
th:first-child, td:first-child{ | ||
th:first-child, td:first-child { | ||
padding-left: 24px; | ||
} | ||
th:last-child, td:last-child{ | ||
th:last-child, td:last-child { | ||
padding-right: 24px; | ||
} | ||
|
||
tr:hover td { | ||
background-color: md-color($md-grey, 200); | ||
tr { | ||
position: relative; | ||
height: $data-table-row-height; | ||
} | ||
.active td { | ||
background-color: md-color($md-grey, 100); | ||
|
||
tbody, .md-data-tbody { | ||
tr { | ||
&.selected, &.active { | ||
background-color: $data-table-selection-color; | ||
} | ||
|
||
&:hover { | ||
background-color: $data-table-hover-color; | ||
} | ||
} | ||
} | ||
|
||
} |
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