Explorar o código

feat(style): use Bootstrap table style

George Cushen %!s(int64=2) %!d(string=hai) anos
pai
achega
8e2b1cc26b

+ 3 - 0
wowchemy/assets/js/wowchemy.js

@@ -201,6 +201,9 @@ function fixHugoOutput() {
 
   // Fix Goldmark task lists (remove bullet points).
   $("input[type='checkbox'][disabled]").parents('ul').addClass('task-list');
+
+  // Bootstrap table style is opt-in and Goldmark doesn't add it.
+  $("table").addClass('.table');
 }
 
 // Get an element's siblings.

+ 10 - 0
wowchemy/assets/scss/wowchemy/elements/_content.scss

@@ -175,6 +175,16 @@ article .article-metadata {
   content: '\00B7';
 }
 
+caption {
+  // Override Bootstrap alignment
+  text-align: center;
+}
+
+// Note default light caption inherited from Bootstrap
+.dark caption {
+  color: rgba(255, 255, 255, 0.8);
+}
+
 /*************************************************
  *  Content widgets
  **************************************************/

+ 4 - 46
wowchemy/assets/scss/wowchemy/elements/_table.scss

@@ -4,8 +4,8 @@
 
 /* Based on Bootstrap's `table-responsive` style. */
 table {
-  display: block;
-  width: 100%;
+  //display: block;
+  //width: 100%;
   overflow-x: scroll;
   margin-bottom: 1rem;
   font-size: 0.8rem;
@@ -15,48 +15,6 @@ table {
   word-break: normal;
 }
 
-table > thead > tr > th,
-table > tbody > tr > th,
-table > tfoot > tr > th,
-table > thead > tr > td,
-table > tbody > tr > td,
-table > tfoot > tr > td {
-  padding: 8px;
-  line-height: 1.43;
-  vertical-align: top;
-  border-top: 1px solid #ddd;
-}
-
-table > thead > tr > th {
-  vertical-align: bottom;
-  border-bottom: 2px solid #ddd;
-}
-
-table > caption + thead > tr:first-child > th,
-table > colgroup + thead > tr:first-child > th,
-table > thead:first-child > tr:first-child > th,
-table > caption + thead > tr:first-child > td,
-table > colgroup + thead > tr:first-child > td,
-table > thead:first-child > tr:first-child > td {
-  border-top: 0;
-}
-
-table > tbody + tbody {
-  border-top: 2px solid #ddd;
-}
-
-table table {
-  background-color: #fff;
-}
-
-/* Table Striped */
-table > tbody > tr:nth-child(odd) > td,
-table > tbody > tr:nth-child(odd) > th {
-  background-color: #f9f9f9;
-}
-
-/* Table Hover */
-table > tbody > tr:hover > td,
-table > tbody > tr:hover > th {
-  background-color: #e5e5e5;
+.dark .table {
+  color: white;
 }

+ 2 - 2
wowchemy/layouts/shortcodes/table.html

@@ -4,7 +4,7 @@
 
 {{ $src := .Get "path" }}
 {{ $delimiter := .Get "delimiter" | default "," }}
-{{ $useHeaderRow := .Get "header" | default true }}
+{{ $useHeaderRow := (eq (lower (.Get "header")) "true") | default true }}
 {{ $caption := .Get "caption" }}
 
 {{ $is_remote := strings.HasPrefix $src "http" }}
@@ -13,7 +13,7 @@
 {{ end }}
 {{ $rows := getCSV $delimiter $src }}
 
-<table>
+<table class="table">
   {{ if $useHeaderRow }}
     {{ $headerRow := index $rows 0 }}
     {{ $rows = after 1 $rows }}