From d508bacd34bd2032aaf532323d599093538c22e8 Mon Sep 17 00:00:00 2001 From: Michael Arestad Date: Thu, 9 Apr 2015 19:25:43 -0600 Subject: [PATCH 1/4] Build: Initial table styles --- demos/tables.html | 56 ++++++++++++++++++++++++++++ scss/atoms/_tables.scss | 68 ++++++++++++++++++++++++++++++++++ scss/atoms/tables/_mixins.scss | 5 +++ scss/atoms/tables/_tables.scss | 36 ++++++++++++++++++ scss/lint.scss | 2 + scss/style.scss | 1 + scss/variables/tables.js | 25 +++++++++++++ 7 files changed, 193 insertions(+) create mode 100644 demos/tables.html create mode 100644 scss/atoms/_tables.scss create mode 100644 scss/atoms/tables/_mixins.scss create mode 100644 scss/atoms/tables/_tables.scss create mode 100644 scss/variables/tables.js diff --git a/demos/tables.html b/demos/tables.html new file mode 100644 index 0000000..ab1180a --- /dev/null +++ b/demos/tables.html @@ -0,0 +1,56 @@ + + + + + CSS Chassis - Tables + + + + + + + + +

CSS Chassis

+ +
+ +

Tables

+ +

Here's a paragraph to show spacing around the table. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum..

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDProductCategoryPrice
1T-ShirtApparel$12.99
2Sweat ShirtApparel$24.99
3NecklaceAccessories$29.99
+ +

Here's a paragraph to show spacing around the table. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum..

+ + + diff --git a/scss/atoms/_tables.scss b/scss/atoms/_tables.scss new file mode 100644 index 0000000..ef7d4e5 --- /dev/null +++ b/scss/atoms/_tables.scss @@ -0,0 +1,68 @@ +// ========================================================================== +// Typography +// ========================================================================== + +table { + width: 100%; + margin-bottom: em( 20px, 16px ); + font-size: em( 16px ); + text-align: left; +} + +thead { + border-bottom: 1px solid #eee; + + > tr > th { + border-top: 0; + } +} + +td { + border-top: 1px solid #eee; + padding: em( 12px, 16px ); +} + +th { + border-top: 1px solid #eee; + padding: em( 12px, 12px ); + color: #666; + font-weight: 400; + font-size: em( 12px, 16px ); + white-space: nowrap; +} + +.table--responsive { + position: relative; + z-index: 1; + margin-bottom: em( 20px ); + border: 0; + background: #fff no-repeat; + background-image: radial-gradient( farthest-side at 0 50%,rgba( 0, 0, 0, .2 ), transparent ), radial-gradient( farthest-side at 100% 50%, rgba( 0, 0, 0, .2 ), transparent ); + background-position: 0 0, 100% 0; + background-size: 10px 100%; + overflow: auto; + + table { + position: relative; + margin-bottom: 0; + + &:before, + &:after { + content: ""; + position: absolute; + top: 0; + bottom: 0; + left: 0; + z-index: -1; + margin: 0 -30px 0 0; + width: 30px; + background: linear-gradient( to right, #fff, #fff 30%, rgba( 255, 255, 255, 0 ) ); + } + &:after { + left: auto; + right: 0; + margin: 0 0 0 -30px; + background: linear-gradient( to right, rgba( 255, 255, 255, 0 ), #fff 70%, #fff ); + } + } +} diff --git a/scss/atoms/tables/_mixins.scss b/scss/atoms/tables/_mixins.scss new file mode 100644 index 0000000..c41640c --- /dev/null +++ b/scss/atoms/tables/_mixins.scss @@ -0,0 +1,5 @@ +/* +* ========================================================================== +* Table mixins +* ========================================================================== +*/ diff --git a/scss/atoms/tables/_tables.scss b/scss/atoms/tables/_tables.scss new file mode 100644 index 0000000..05dbc06 --- /dev/null +++ b/scss/atoms/tables/_tables.scss @@ -0,0 +1,36 @@ +/* +* ========================================================================== +* Tables +* ========================================================================== +*/ + +@import + "dist/chassis", + "mixins"; + +table { + margin: map-get($table-base, margin); + font-size: map-get($table-base, font-size); + text-align: left; +} + +thead { + border-bottom: map-get($table-base, border); + > tr > th { + border-top: 0; + } +} + +td { + border-top: map-get($table-base, border); + padding: map-get($table-base, padding); +} + +th { + border-top: map-get($table-base, border); + padding: map-get($table-base, padding); + color: map-get($text, light); + font-weight: 400; + font-size: map-get($table-base, thead-font-size); + white-space: nowrap; +} diff --git a/scss/lint.scss b/scss/lint.scss index aeebcb0..487f4e9 100644 --- a/scss/lint.scss +++ b/scss/lint.scss @@ -18,6 +18,8 @@ @import "atoms/icons/icons", "atoms/typography/typography", + "atoms/tables", + "atoms/overflow-indicator", "atoms/buttons/buttons"; @import diff --git a/scss/style.scss b/scss/style.scss index 81b166a..756bba4 100644 --- a/scss/style.scss +++ b/scss/style.scss @@ -10,6 +10,7 @@ @import "atoms/icons/icons", "atoms/typography/typography", + "atoms/tables/tables", "atoms/buttons/buttons"; @import diff --git a/scss/variables/tables.js b/scss/variables/tables.js new file mode 100644 index 0000000..f2bfd4d --- /dev/null +++ b/scss/variables/tables.js @@ -0,0 +1,25 @@ +( function( root, factory ) { + if ( typeof define === "function" && define.amd ) { + define( [ "./chassis" ], factory ); + } else if ( typeof exports === "object" ) { + module.exports = factory( require( "./chassis" ) ); + } else { + root.chassis = factory( root.chassis ); + } +}( this, function( chassis ) { + +chassis.table = { + "table-base": { + name: "Table Element", + value: { + "margin": "0 0 1em", + "font-size": "16px", + "thead-font-size": "12px", + "border": "1px solid #eee", + "padding": "12px" + } + } +}; + +return chassis; +} ) ); From 0d78e4955423d0f12ae03fdc3e815fd34dfe2d49 Mon Sep 17 00:00:00 2001 From: Kristy Yeaton Date: Mon, 9 May 2016 19:32:39 -0400 Subject: [PATCH 2/4] Tables: Updating tables to reflect new JSASS var changes. --- scss/atoms/tables/_tables.scss | 2 +- scss/variables/tables.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scss/atoms/tables/_tables.scss b/scss/atoms/tables/_tables.scss index 05dbc06..b586e59 100644 --- a/scss/atoms/tables/_tables.scss +++ b/scss/atoms/tables/_tables.scss @@ -29,7 +29,7 @@ td { th { border-top: map-get($table-base, border); padding: map-get($table-base, padding); - color: map-get($text, light); + color: map-get($colors-text, light); font-weight: 400; font-size: map-get($table-base, thead-font-size); white-space: nowrap; diff --git a/scss/variables/tables.js b/scss/variables/tables.js index f2bfd4d..f7baf1f 100644 --- a/scss/variables/tables.js +++ b/scss/variables/tables.js @@ -9,7 +9,7 @@ }( this, function( chassis ) { chassis.table = { - "table-base": { + "base": { name: "Table Element", value: { "margin": "0 0 1em", From e55e487f0f03b4aaa471b53fef9bab0b21f28c96 Mon Sep 17 00:00:00 2001 From: Kristy Yeaton Date: Mon, 9 May 2016 21:44:23 -0400 Subject: [PATCH 3/4] Tables: Convert element styles to classes and add example using divs --- demos/tables.html | 77 ++++++++++++++++++++++++---------- scss/atoms/_tables.scss | 68 ------------------------------ scss/atoms/tables/_tables.scss | 40 +++++++++++++----- 3 files changed, 83 insertions(+), 102 deletions(-) delete mode 100644 scss/atoms/_tables.scss diff --git a/demos/tables.html b/demos/tables.html index ab1180a..5d45168 100644 --- a/demos/tables.html +++ b/demos/tables.html @@ -19,38 +19,69 @@

Tables

Here's a paragraph to show spacing around the table. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum..

- - - - - - - +
IDProductCategoryPrice
+ + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + +
IDProductCategoryPrice
1T-ShirtApparel$12.99
1T-ShirtApparel$12.99
2Sweat ShirtApparel$24.99
2Sweat ShirtApparel$24.99
3NecklaceAccessories$29.99
3NecklaceAccessories$29.99

Here's a paragraph to show spacing around the table. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum..

+
+
+
+
ID
+
Product
+
Category
+
Price
+
+
+
+
+
1
+
T-Shirt
+
Apparel
+
$12.99
+
+
+
2
+
Sweat Shirt
+
Apparel
+
$24.99
+
+
+
3
+
Necklace
+
Accessories
+
$29.99
+
+
+
+ diff --git a/scss/atoms/_tables.scss b/scss/atoms/_tables.scss deleted file mode 100644 index ef7d4e5..0000000 --- a/scss/atoms/_tables.scss +++ /dev/null @@ -1,68 +0,0 @@ -// ========================================================================== -// Typography -// ========================================================================== - -table { - width: 100%; - margin-bottom: em( 20px, 16px ); - font-size: em( 16px ); - text-align: left; -} - -thead { - border-bottom: 1px solid #eee; - - > tr > th { - border-top: 0; - } -} - -td { - border-top: 1px solid #eee; - padding: em( 12px, 16px ); -} - -th { - border-top: 1px solid #eee; - padding: em( 12px, 12px ); - color: #666; - font-weight: 400; - font-size: em( 12px, 16px ); - white-space: nowrap; -} - -.table--responsive { - position: relative; - z-index: 1; - margin-bottom: em( 20px ); - border: 0; - background: #fff no-repeat; - background-image: radial-gradient( farthest-side at 0 50%,rgba( 0, 0, 0, .2 ), transparent ), radial-gradient( farthest-side at 100% 50%, rgba( 0, 0, 0, .2 ), transparent ); - background-position: 0 0, 100% 0; - background-size: 10px 100%; - overflow: auto; - - table { - position: relative; - margin-bottom: 0; - - &:before, - &:after { - content: ""; - position: absolute; - top: 0; - bottom: 0; - left: 0; - z-index: -1; - margin: 0 -30px 0 0; - width: 30px; - background: linear-gradient( to right, #fff, #fff 30%, rgba( 255, 255, 255, 0 ) ); - } - &:after { - left: auto; - right: 0; - margin: 0 0 0 -30px; - background: linear-gradient( to right, rgba( 255, 255, 255, 0 ), #fff 70%, #fff ); - } - } -} diff --git a/scss/atoms/tables/_tables.scss b/scss/atoms/tables/_tables.scss index b586e59..13558a2 100644 --- a/scss/atoms/tables/_tables.scss +++ b/scss/atoms/tables/_tables.scss @@ -8,29 +8,47 @@ "dist/chassis", "mixins"; -table { +.table { + display: table; margin: map-get($table-base, margin); font-size: map-get($table-base, font-size); text-align: left; } -thead { - border-bottom: map-get($table-base, border); - > tr > th { - border-top: 0; - } +/* thead */ +.table-head { + display: table-header-group; } -td { - border-top: map-get($table-base, border); - padding: map-get($table-base, padding); +/* tbody */ +.table-body { + display: table-row-group; +} + +/* tfoot */ +.table-foot { + display: table-footer-group; +} + +/* tr */ +.table-row { + display: table-row; } -th { +/* th */ +.table-heading { + display: table-cell; border-top: map-get($table-base, border); padding: map-get($table-base, padding); color: map-get($colors-text, light); font-weight: 400; font-size: map-get($table-base, thead-font-size); - white-space: nowrap; + //white-space: nowrap; +} + +/* td */ +.table-cell { + display: table-cell; + border-top: map-get($table-base, border); + padding: map-get($table-base, padding); } From 450b15fb9fda7b3e284d94c32a7b2f6ad464807b Mon Sep 17 00:00:00 2001 From: Kristy Yeaton Date: Mon, 9 May 2016 22:01:45 -0400 Subject: [PATCH 4/4] Tables: Remove scope attributes from div table --- demos/tables.html | 14 +++++++------- scss/atoms/tables/_tables.scss | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/demos/tables.html b/demos/tables.html index 5d45168..4d40e9c 100644 --- a/demos/tables.html +++ b/demos/tables.html @@ -55,27 +55,27 @@

Tables

-
ID
-
Product
-
Category
-
Price
+
ID
+
Product
+
Category
+
Price
-
1
+
1
T-Shirt
Apparel
$12.99
-
2
+
2
Sweat Shirt
Apparel
$24.99
-
3
+
3
Necklace
Accessories
$29.99
diff --git a/scss/atoms/tables/_tables.scss b/scss/atoms/tables/_tables.scss index 13558a2..6a7f7d6 100644 --- a/scss/atoms/tables/_tables.scss +++ b/scss/atoms/tables/_tables.scss @@ -43,7 +43,6 @@ color: map-get($colors-text, light); font-weight: 400; font-size: map-get($table-base, thead-font-size); - //white-space: nowrap; } /* td */