table.sass 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. $table-color: $grey-darker !default
  2. $table-background-color: $white !default
  3. $table-cell-border: 1px solid $grey-lighter !default
  4. $table-cell-border-width: 0 0 1px !default
  5. $table-cell-padding: 0.5em 0.75em !default
  6. $table-cell-heading-color: $text-strong !default
  7. $table-head-cell-border-width: 0 0 2px !default
  8. $table-head-cell-color: $text-strong !default
  9. $table-foot-cell-border-width: 2px 0 0 !default
  10. $table-foot-cell-color: $text-strong !default
  11. $table-row-hover-background-color: $white-bis !default
  12. $table-row-active-background-color: $primary !default
  13. $table-row-active-color: $primary-invert !default
  14. $table-striped-row-even-background-color: $white-bis !default
  15. $table-striped-row-even-hover-background-color: $white-ter !default
  16. .table
  17. background-color: $table-background-color
  18. color: $table-color
  19. margin-bottom: 1.5rem
  20. td,
  21. th
  22. border: $table-cell-border
  23. border-width: $table-cell-border-width
  24. padding: $table-cell-padding
  25. vertical-align: top
  26. // Colors
  27. @each $name, $pair in $colors
  28. $color: nth($pair, 1)
  29. $color-invert: nth($pair, 2)
  30. &.is-#{$name}
  31. background-color: $color
  32. border-color: $color
  33. color: $color-invert
  34. // Modifiers
  35. &.is-narrow
  36. white-space: nowrap
  37. width: 1%
  38. &.is-selected
  39. background-color: $table-row-active-background-color
  40. color: $table-row-active-color
  41. a,
  42. strong
  43. color: currentColor
  44. th
  45. color: $table-cell-heading-color
  46. text-align: left
  47. tr
  48. &.is-selected
  49. background-color: $table-row-active-background-color
  50. color: $table-row-active-color
  51. a,
  52. strong
  53. color: currentColor
  54. td,
  55. th
  56. border-color: $table-row-active-color
  57. color: currentColor
  58. thead
  59. td,
  60. th
  61. border-width: $table-head-cell-border-width
  62. color: $table-head-cell-color
  63. tfoot
  64. td,
  65. th
  66. border-width: $table-foot-cell-border-width
  67. color: $table-foot-cell-color
  68. tbody
  69. tr
  70. &:last-child
  71. td,
  72. th
  73. border-bottom-width: 0
  74. // Modifiers
  75. &.is-bordered
  76. td,
  77. th
  78. border-width: 1px
  79. tr
  80. &:last-child
  81. td,
  82. th
  83. border-bottom-width: 1px
  84. &.is-fullwidth
  85. width: 100%
  86. &.is-hoverable
  87. tbody
  88. tr:not(.is-selected)
  89. &:hover
  90. background-color: $table-row-hover-background-color
  91. &.is-striped
  92. tbody
  93. tr:not(.is-selected)
  94. &:hover
  95. background-color: $table-striped-row-even-hover-background-color
  96. &.is-narrow
  97. td,
  98. th
  99. padding: 0.25em 0.5em
  100. &.is-striped
  101. tbody
  102. tr:not(.is-selected)
  103. &:nth-child(even)
  104. background-color: $table-striped-row-even-background-color