panel.less 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. // stylelint-disable selector-max-type, selector-max-compound-selectors, selector-max-combinators, no-duplicate-selectors
  2. //
  3. // Panels
  4. // --------------------------------------------------
  5. .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) {
  6. border-color: @border;
  7. & > .panel-heading {
  8. color: @heading-text-color;
  9. background-color: @heading-bg-color;
  10. border-color: @heading-border;
  11. + .panel-collapse > .panel-body {
  12. border-top-color: @border;
  13. }
  14. .badge {
  15. color: @heading-bg-color;
  16. background-color: @heading-text-color;
  17. }
  18. }
  19. & > .panel-footer {
  20. + .panel-collapse > .panel-body {
  21. border-bottom-color: @border;
  22. }
  23. }
  24. }
  25. // Base class
  26. .panel {
  27. margin-bottom: @line-height-computed;
  28. background-color: @panel-bg;
  29. border: 1px solid transparent;
  30. border-radius: @panel-border-radius;
  31. box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
  32. }
  33. // Panel contents
  34. .panel-body {
  35. padding: @panel-body-padding;
  36. &:extend(.clearfix all);
  37. }
  38. // Optional heading
  39. .panel-heading {
  40. padding: @panel-heading-padding;
  41. border-bottom: 1px solid transparent;
  42. border-top-left-radius: (@panel-border-radius - 1);
  43. border-top-right-radius: (@panel-border-radius - 1);
  44. > .dropdown .dropdown-toggle {
  45. color: inherit;
  46. }
  47. }
  48. // Within heading, strip any `h*` tag of its default margins for spacing.
  49. .panel-title {
  50. margin-top: 0;
  51. margin-bottom: 0;
  52. font-size: ceil((@font-size-base * 1.125));
  53. color: inherit;
  54. > a,
  55. > small,
  56. > .small,
  57. > small > a,
  58. > .small > a {
  59. color: inherit;
  60. }
  61. }
  62. // Optional footer (stays gray in every modifier class)
  63. .panel-footer {
  64. padding: @panel-footer-padding;
  65. background-color: @panel-footer-bg;
  66. border-top: 1px solid @panel-inner-border;
  67. border-bottom-right-radius: (@panel-border-radius - 1);
  68. border-bottom-left-radius: (@panel-border-radius - 1);
  69. }
  70. // List groups in panels
  71. //
  72. // By default, space out list group content from panel headings to account for
  73. // any kind of custom content between the two.
  74. .panel {
  75. > .list-group,
  76. > .panel-collapse > .list-group {
  77. margin-bottom: 0;
  78. .list-group-item {
  79. border-width: 1px 0;
  80. border-radius: 0;
  81. }
  82. // Add border top radius for first one
  83. &:first-child {
  84. .list-group-item:first-child {
  85. border-top: 0;
  86. border-top-left-radius: (@panel-border-radius - 1);
  87. border-top-right-radius: (@panel-border-radius - 1);
  88. }
  89. }
  90. // Add border bottom radius for last one
  91. &:last-child {
  92. .list-group-item:last-child {
  93. border-bottom: 0;
  94. border-bottom-right-radius: (@panel-border-radius - 1);
  95. border-bottom-left-radius: (@panel-border-radius - 1);
  96. }
  97. }
  98. }
  99. > .panel-heading + .panel-collapse > .list-group {
  100. .list-group-item:first-child {
  101. border-top-left-radius: 0;
  102. border-top-right-radius: 0;
  103. }
  104. }
  105. }
  106. // Collapse space between when there's no additional content.
  107. .panel-heading + .list-group {
  108. .list-group-item:first-child {
  109. border-top-width: 0;
  110. }
  111. }
  112. .list-group + .panel-footer {
  113. border-top-width: 0;
  114. }
  115. // Tables in panels
  116. //
  117. // Place a non-bordered `.table` within a panel (not within a `.panel-body`) and
  118. // watch it go full width.
  119. .panel {
  120. > .table,
  121. > .panel-collapse > .table {
  122. margin-bottom: 0;
  123. caption {
  124. padding-right: @panel-body-padding;
  125. padding-left: @panel-body-padding;
  126. }
  127. }
  128. // Add border top radius for first one
  129. > .table:first-child {
  130. border-top-left-radius: (@panel-border-radius - 1);
  131. border-top-right-radius: (@panel-border-radius - 1);
  132. > thead:first-child,
  133. > tbody:first-child {
  134. > tr:first-child {
  135. border-top-left-radius: (@panel-border-radius - 1);
  136. border-top-right-radius: (@panel-border-radius - 1);
  137. td:first-child,
  138. th:first-child {
  139. border-top-left-radius: (@panel-border-radius - 1);
  140. }
  141. td:last-child,
  142. th:last-child {
  143. border-top-right-radius: (@panel-border-radius - 1);
  144. }
  145. }
  146. }
  147. }
  148. // Add border bottom radius for last one
  149. > .table:last-child {
  150. border-bottom-right-radius: (@panel-border-radius - 1);
  151. border-bottom-left-radius: (@panel-border-radius - 1);
  152. > tbody:last-child,
  153. > tfoot:last-child {
  154. > tr:last-child {
  155. border-bottom-right-radius: (@panel-border-radius - 1);
  156. border-bottom-left-radius: (@panel-border-radius - 1);
  157. td:first-child,
  158. th:first-child {
  159. border-bottom-left-radius: (@panel-border-radius - 1);
  160. }
  161. td:last-child,
  162. th:last-child {
  163. border-bottom-right-radius: (@panel-border-radius - 1);
  164. }
  165. }
  166. }
  167. }
  168. > .panel-body + .table,
  169. > .table + .panel-body {
  170. border-top: 1px solid @table-border-color;
  171. }
  172. > .table > tbody:first-child > tr:first-child th,
  173. > .table > tbody:first-child > tr:first-child td {
  174. border-top: 0;
  175. }
  176. }
  177. // Collapsible panels (aka, accordion)
  178. //
  179. // Wrap a series of panels in `.panel-group` to turn them into an accordion with
  180. // the help of our collapse JavaScript plugin.
  181. .panel-group {
  182. margin-bottom: @line-height-computed;
  183. // Tighten up margin so it's only between panels
  184. .panel {
  185. margin-bottom: 0;
  186. border-radius: @panel-border-radius;
  187. + .panel {
  188. margin-top: 5px;
  189. }
  190. }
  191. .panel-heading {
  192. border-bottom: 0;
  193. + .panel-collapse > .panel-body,
  194. + .panel-collapse > .list-group {
  195. border-top: 1px solid @panel-inner-border;
  196. }
  197. }
  198. .panel-footer {
  199. border-top: 0;
  200. + .panel-collapse .panel-body {
  201. border-bottom: 1px solid @panel-inner-border;
  202. }
  203. }
  204. }
  205. // Contextual variations
  206. .panel-default {
  207. .panel-variant(
  208. @panel-default-border; @panel-default-text; @panel-default-heading-bg;
  209. @panel-default-border
  210. );
  211. }
  212. .panel-primary {
  213. .panel-variant(
  214. @panel-primary-border; @panel-primary-text; @panel-primary-heading-bg;
  215. @panel-primary-border
  216. );
  217. }
  218. .panel-success {
  219. .panel-variant(
  220. @panel-success-border; @panel-success-text; @panel-success-heading-bg;
  221. @panel-success-border
  222. );
  223. }
  224. .panel-info {
  225. .panel-variant(
  226. @panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border
  227. );
  228. }
  229. .panel-warning {
  230. .panel-variant(
  231. @panel-warning-border; @panel-warning-text; @panel-warning-heading-bg;
  232. @panel-warning-border
  233. );
  234. }
  235. .panel-danger {
  236. .panel-variant(
  237. @panel-danger-border; @panel-danger-text; @panel-danger-heading-bg;
  238. @panel-danger-border
  239. );
  240. }
  241. //
  242. // Sentry Panel
  243. // Extends Bootstrap's panels
  244. //
  245. // Variables for this component can be found in variables.less
  246. //
  247. .panel {
  248. .panel-heading {
  249. h1,
  250. h2,
  251. h3,
  252. h4,
  253. h5,
  254. h6 {
  255. font-size: 16px;
  256. margin: 0;
  257. }
  258. }
  259. .panel-heading-bold {
  260. color: @60;
  261. font-size: 12px;
  262. font-weight: 600;
  263. text-transform: uppercase;
  264. line-height: 1;
  265. }
  266. }