1
0
mirror of https://github.com/Chalarangelo/mini.css.git synced 2025-03-14 01:09:38 +01:00

Table desktop view

This commit is contained in:
Angelos Chalaris 2018-01-02 14:29:21 +02:00
parent d59be35ceb
commit 9288ef1a77
5 changed files with 220 additions and 1 deletions

95
dist/mini-default.css vendored
View File

@ -1680,3 +1680,98 @@ progress.tertiary {
.spinner.tertiary {
--spinner-fore-color: #308732;
}
/*
Definitions for the responsive table component.
*/
/*
$table-mobile-breakpoint: 767px !default; // Breakpoint for table mobile view.
$table-mobile-card-spacing: 10px !default; // Space between <tr> cards - mobile view.
$table-mobile-card-label: 'data-label' !default;// Attribute used to replace column headers in mobile view.
$table-not-responsive-name: 'preset' !default; // Class name for table non-responsive view.
$include-horizontal-table: true !default; // Should horizontal tables be included? (`true`/`false`)
$table-horizontal-name: 'horizontal' !default;// Class name for table horizontal view.
$include-scrollable-table: true !default; // Should scrollable tables be included? (`true`/`false`)
$table-scrollable-name: 'scrollable' !default;// Class name for table scrollable view.
$table-scrollable-height: 400px !default; // Height for table scrollable view.
$include-striped-table: true !default; // [Hidden flag] Should striped tables be included? (`true`/`false`)
$table-striped-name: 'striped' !default; // Class name for striped table.
// External variables' defaults are used only if you import this module on its own, without the rest of the framework.
$back-color: white !default; // [External variable - core] Background color for everything.
$fore-color: black !default; // [External variable - core] Foreground color for everything.
*/
/* Table module CSS variable definitions. */
:root {
--table-border-color: #aaa;
}
table {
border-collapse: separate;
border-spacing: 0;
margin: 0;
display: flex;
flex: 0 1 auto;
flex-flow: row wrap;
padding: var(--universal-padding);
padding-top: 0;
overflow: auto;
max-height: 400px;
}
table caption {
font-size: 1.5rem;
margin: calc(2 * var(--universal-margin)) 0;
max-width: 100%;
flex: 0 0 100%;
}
table thead, table tbody {
display: flex;
max-width: 100%;
flex-flow: row wrap;
flex: 0 0 100%;
border: 0.0625rem solid var(--table-border-color);
}
table thead {
z-index: 999;
position: sticky;
top: 0;
border-radius: var(--universal-border-radius) var(--universal-border-radius) 0 0;
border-bottom: 0.0625rem solid #666;
}
table tbody {
border-top: 0;
margin-top: calc(0 - var(--universal-margin));
border-radius: 0 0 var(--universal-border-radius) var(--universal-border-radius);
}
table tr {
display: flex;
flex-flow: row wrap;
flex: 0 0 100%;
padding: 0;
}
table th, table td {
padding: calc(2 * var(--universal-margin));
flex: 1 0 0%;
overflow: hidden;
text-overflow: ellipsis;
}
table th {
text-align: left;
background: #e6e6e6;
color: #111;
}
table td {
background: #fafafa;
border-top: 0.0625rem solid var(--table-border-color);
}
table tbody tr:first-child td {
border-top: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -253,3 +253,8 @@
- Documented `progress` element.
- Documented `spinner` component.
## 20180102
- Started working on `table` module. Tables are now scrollable by default.
- Coded desktop view for `table`, no `@media` queries in there yet, but there will be more sooner rather than later.

View File

@ -86,6 +86,7 @@ $button-large-margin: var(#{$universal-margin-var});
@include make-button-alt-size ($button-large-name, $button-large-padding, $button-large-margin);
@import '../mini/navigation';
// @import '../mini/table';
@import '../mini/contextual';
/*
@ -132,3 +133,5 @@ $spinner-donut-secondary-fore-color: #d32f2f; // Foreground color for second
$spinner-donut-tertiary-name: 'tertiary'; // Class name for tertiary spinner donut color variant.
$spinner-donut-tertiary-fore-color: #308732; // Foreground color for tertiary spinner donut color variant.
@include make-spinner-donut-alt-color ($spinner-donut-tertiary-name, $spinner-donut-tertiary-fore-color);
@import '../mini/table';

116
src/mini/_table.scss Normal file
View File

@ -0,0 +1,116 @@
/*
Definitions for the responsive table component.
*/
// The tables use the common table elements and syntax.
/*
$table-mobile-breakpoint: 767px !default; // Breakpoint for table mobile view.
$table-mobile-card-spacing: 10px !default; // Space between <tr> cards - mobile view.
$table-mobile-card-label: 'data-label' !default;// Attribute used to replace column headers in mobile view.
$table-not-responsive-name: 'preset' !default; // Class name for table non-responsive view.
$include-horizontal-table: true !default; // Should horizontal tables be included? (`true`/`false`)
$table-horizontal-name: 'horizontal' !default;// Class name for table horizontal view.
$include-scrollable-table: true !default; // Should scrollable tables be included? (`true`/`false`)
$table-scrollable-name: 'scrollable' !default;// Class name for table scrollable view.
$table-scrollable-height: 400px !default; // Height for table scrollable view.
$include-striped-table: true !default; // [Hidden flag] Should striped tables be included? (`true`/`false`)
$table-striped-name: 'striped' !default; // Class name for striped table.
// External variables' defaults are used only if you import this module on its own, without the rest of the framework.
$back-color: white !default; // [External variable - core] Background color for everything.
$fore-color: black !default; // [External variable - core] Foreground color for everything.
*/
$table-max-height: 400px !default;
$table-caption-font-size: 1.5rem !default;
$table-border-color: #aaa !default;
// CSS variable name definitions [exercise caution if modifying these]
$table-border-color-var: '--table-border-color' !default;
// == Uncomment below code if this module is used on its own ==
//
// $universal-margin: 0.5rem !default; // Universal margin for the most elements
// $universal-padding: 0.5rem !default; // Universal padding for the most elements
// $universal-border-radius: 0.125rem !default; // Universal border-radius for most elements
// $universal-box-shadow: none !default; // Universal box-shadow for most elements
// $universal-margin-var: '--universal-margin' !default;
// $universal-padding-var: '--universal-padding' !default;
// $universal-border-radius-var: '--universal-border-radius' !default;
// $universal-box-shadow-var: '--universal-box-shadow' !default;
// :root {
// #{$universal-margin-var}: $universal-margin;
// #{$universal-padding-var}: $universal-padding;
// #{$universal-border-radius-var}: $universal-border-radius;
// @if $universal-box-shadow != none {
// #{$universal-box-shadow-var}: $universal-box-shadow;
// }
// }
//
// ============================================================
/* Table module CSS variable definitions. */
:root {
#{$table-border-color-var}: $table-border-color;
}
// Desktop view.
table {
border-collapse: separate;
border-spacing: 0;
margin: 0;
display: flex;
flex: 0 1 auto;
flex-flow: row wrap;
padding: var(#{$universal-padding-var});
padding-top: 0;
overflow: auto;
max-height: $table-max-height;
caption {
font-size: $table-caption-font-size;
margin: calc(2 * var(#{$universal-margin-var})) 0;
max-width: 100%;
flex: 0 0 100%;
}
thead, tbody {
display: flex;
max-width: 100%;
flex-flow: row wrap;
flex: 0 0 100%;
border: $__1px solid var(#{$table-border-color-var});
}
thead {
z-index: 999; // Fixes the visibility of the element.
position: sticky;
top: 0;
border-radius: var(#{$universal-border-radius-var}) var(#{$universal-border-radius-var}) 0 0;
border-bottom: 0.0625rem solid #666; // var This
}
tbody {
border-top: 0;
margin-top: calc(0 - var(#{$universal-margin-var}));
border-radius: 0 0 var(--universal-border-radius) var(--universal-border-radius);
}
tr {
display: flex;
flex-flow: row wrap;
flex: 0 0 100%;
padding: 0; // Apply always to overwrite default.
}
th, td {
padding: calc(2 * var(#{$universal-margin-var})); // Apply always to overwrite default.
flex: 1 0 0%;
overflow: hidden;
text-overflow: ellipsis;
}
th {
text-align: left;
background: #e6e6e6; // use vars
color: #111; // vars
}
td {
background: #fafafa; // use variables, this is a test
border-top: $__1px solid var(#{$table-border-color-var});
}
tbody tr:first-child td {
border-top: 0;
}
}