_timelines.scss 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /* ------------------------------------------------------------------------------
  2. *
  3. * # Timeline
  4. *
  5. * Styles for timeline in 3 layouts: left, right and centered
  6. *
  7. * ---------------------------------------------------------------------------- */
  8. // Check if component is enabled
  9. @if $enable-timeline {
  10. // Base
  11. .timeline {
  12. position: relative;
  13. // Dots base
  14. &:before,
  15. &:after {
  16. content: "";
  17. position: absolute;
  18. left: 50%;
  19. margin-left: -($timeline-line-width);
  20. background-color: $timeline-line-color;
  21. z-index: 1;
  22. @include size($timeline-line-width * 2);
  23. @include border-radius($border-radius-circle);
  24. }
  25. // Top dot
  26. &:before {
  27. top: 0;
  28. }
  29. // Bottom dot
  30. &:after {
  31. bottom: 0;
  32. }
  33. }
  34. // Container
  35. .timeline-container {
  36. position: relative;
  37. padding-top: ($spacer / 2);
  38. margin-top: -($spacer / 2);
  39. padding-bottom: 1px;
  40. // Vertical line
  41. &:after {
  42. content: "";
  43. position: absolute;
  44. top: 0;
  45. left: 50%;
  46. margin-left: -($timeline-line-width / 2);
  47. background-color: $timeline-line-color;
  48. height: 100%;
  49. width: $timeline-line-width;
  50. z-index: -1;
  51. }
  52. }
  53. // Row
  54. .timeline-row {
  55. position: relative;
  56. }
  57. // Date
  58. .timeline-date {
  59. text-align: center;
  60. background-color: $body-bg;
  61. position: relative;
  62. z-index: 1;
  63. padding-top: $spacer;
  64. padding-bottom: $spacer;
  65. margin-bottom: $spacer;
  66. // Dots base
  67. &:before,
  68. &:after {
  69. content: "";
  70. position: absolute;
  71. left: 50%;
  72. margin-left: -($timeline-line-width);
  73. background-color: $timeline-line-color;
  74. z-index: 1;
  75. @include size($timeline-line-width * 2);
  76. @include border-radius($border-radius-circle);
  77. }
  78. // Top dot
  79. &:before {
  80. top: 0;
  81. }
  82. // Bottom dot
  83. &:after {
  84. bottom: 0;
  85. }
  86. // Change bg color to card bg if inside card
  87. .card & {
  88. background-color: $card-bg;
  89. }
  90. }
  91. // Time
  92. .timeline-time {
  93. text-align: center;
  94. padding-top: $spacer;
  95. padding-bottom: $spacer;
  96. background-color: $body-bg;
  97. position: relative;
  98. margin-bottom: $spacer;
  99. // Dots base
  100. &:before,
  101. &:after {
  102. content: "";
  103. position: absolute;
  104. left: 50%;
  105. margin-left: -($timeline-line-width);
  106. background-color: $timeline-line-color;
  107. @include size($timeline-line-width * 2);
  108. @include border-radius($border-radius-circle);
  109. }
  110. // Top dot
  111. &:before {
  112. top: 0;
  113. }
  114. // Bottom dot
  115. &:after {
  116. bottom: 0;
  117. }
  118. // Change bg color to card bg if inside card
  119. .card & {
  120. background-color: $card-bg;
  121. }
  122. // Hide dots no desktop
  123. @include media-breakpoint-up(md) {
  124. &:before,
  125. &:after {
  126. content: none;
  127. }
  128. }
  129. }
  130. // Icon and image
  131. .timeline-icon {
  132. margin: 0 auto $spacer auto;
  133. background-color: $timeline-icon-bg;
  134. border: $timeline-icon-border-width solid $body-bg;
  135. @include size($timeline-icon-size);
  136. @include border-radius($border-radius-circle);
  137. // Change border color if it's inside card
  138. .card & {
  139. border-color: $card-bg;
  140. }
  141. // Icon
  142. div {
  143. height: 100%;
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. box-shadow: 0 0 0 $timeline-line-width $timeline-line-color inset;
  148. @include border-radius($border-radius-circle);
  149. // Hide border if icon wrapper has dark color
  150. &[class*=bg-]:not(.bg-white):not(.bg-light):not(.bg-transparent) {
  151. box-shadow: none;
  152. }
  153. // Icon
  154. > i {
  155. top: 0;
  156. }
  157. }
  158. // Image
  159. img {
  160. @include size($timeline-icon-size - rem-calc($timeline-icon-border-width * 2));
  161. @include border-radius($border-radius-circle);
  162. }
  163. }
  164. //
  165. // Responsive config
  166. //
  167. @include media-breakpoint-up(md) {
  168. // Positions
  169. // ------------------------------
  170. // Center layout
  171. .timeline-center {
  172. // Left blocks
  173. .timeline-row-left {
  174. margin-right: 50%;
  175. padding-right: $timeline-icon-size - rem-calc($timeline-icon-border-width);
  176. }
  177. // Right blocks
  178. .timeline-row-right {
  179. margin-left: 50%;
  180. padding-left: $timeline-icon-size - rem-calc($timeline-icon-border-width);
  181. }
  182. }
  183. // Left layout
  184. .timeline-left {
  185. // Vertical line
  186. .timeline-container:after,
  187. &:before,
  188. &:after,
  189. .timeline-date:before,
  190. .timeline-date:after {
  191. left: ($timeline-icon-size / 2);
  192. }
  193. // Content padding
  194. .timeline-row,
  195. .timeline-date {
  196. padding-left: ($timeline-icon-size + $timeline-content-padding-x);
  197. }
  198. }
  199. // Right layout
  200. .timeline-right {
  201. // Vertical line
  202. .timeline-container:after,
  203. &:before,
  204. &:after,
  205. .timeline-date:before,
  206. .timeline-date:after {
  207. left: auto;
  208. right: ($timeline-icon-size / 2);
  209. margin-left: 0;
  210. margin-right: -($timeline-line-width);
  211. }
  212. .timeline-container:after {
  213. margin-right: -($timeline-line-width / 2);
  214. }
  215. // Content padding
  216. .timeline-row,
  217. .timeline-date {
  218. padding-right: ($timeline-icon-size + $timeline-content-padding-x);
  219. }
  220. }
  221. // Reduce date vertical spacing in both
  222. .timeline-left .timeline-date,
  223. .timeline-right .timeline-date {
  224. padding-top: ($spacer / 2);
  225. padding-bottom: ($spacer / 2);
  226. }
  227. // Icon
  228. // ------------------------------
  229. // Base
  230. .timeline-icon {
  231. position: absolute;
  232. top: ($spacer / 2);
  233. // Horizontal line base
  234. &:after {
  235. content: "";
  236. position: absolute;
  237. top: 50%;
  238. margin-top: -($timeline-line-width / 2);
  239. height: $timeline-line-width;
  240. width: ($timeline-icon-size / 2) - rem-calc($timeline-icon-border-width * 2);
  241. background-color: $timeline-line-color;
  242. z-index: 1;
  243. }
  244. }
  245. // In left layout
  246. .timeline-left {
  247. .timeline-icon {
  248. left: 0;
  249. // Right line
  250. &:after {
  251. left: 100%;
  252. margin-left: $timeline-icon-border-width;
  253. }
  254. }
  255. }
  256. // In right layout
  257. .timeline-right {
  258. .timeline-icon {
  259. right: 0;
  260. // Left line
  261. &:after {
  262. right: 100%;
  263. margin-right: $timeline-icon-border-width;
  264. }
  265. }
  266. }
  267. // In centered layout
  268. .timeline-center {
  269. // In left block
  270. .timeline-row-left {
  271. .timeline-icon {
  272. left: 100%;
  273. margin-left: -($timeline-icon-size / 2);
  274. // Left horizontal line
  275. &:after {
  276. right: 100%;
  277. margin-right: $timeline-icon-border-width;
  278. }
  279. }
  280. }
  281. // In right block
  282. .timeline-row-right {
  283. .timeline-icon {
  284. right: 100%;
  285. margin-right: -($timeline-icon-size / 2);
  286. // Right horizontal line
  287. &:after {
  288. left: 100%;
  289. margin-left: $timeline-icon-border-width;
  290. }
  291. }
  292. }
  293. // Full width post
  294. .timeline-row-full .timeline-icon {
  295. position: static;
  296. // Remove horizontal line
  297. &:after {
  298. content: none;
  299. }
  300. }
  301. }
  302. // Time
  303. // ------------------------------
  304. .timeline-time {
  305. padding: 0;
  306. text-align: inherit;
  307. background-color: transparent;
  308. // Hide dots
  309. &:before {
  310. content: none;
  311. }
  312. }
  313. // In left and right layouts
  314. .timeline-left,
  315. .timeline-right {
  316. .timeline-time {
  317. padding-top: ($spacer / 2);
  318. margin-bottom: $spacer;
  319. padding-left: ($timeline-content-padding-x / 2);
  320. }
  321. }
  322. .timeline-right .timeline-time {
  323. text-align: right;
  324. padding-left: 0;
  325. padding-right: ($timeline-content-padding-x / 2);
  326. }
  327. // In center layout
  328. .timeline-center {
  329. .timeline-time,
  330. .timeline-row-full .timeline-time {
  331. position: absolute;
  332. left: 100%;
  333. top: ($spacer / 2) + rem-calc($timeline-icon-border-width);
  334. width: 100%;
  335. padding-left: $timeline-icon-size - rem-calc($timeline-icon-border-width);
  336. }
  337. // Right aligned post
  338. .timeline-row-right,
  339. .timeline-row-full {
  340. .timeline-time {
  341. left: auto;
  342. right: 100%;
  343. padding-left: 0;
  344. padding-right: $timeline-icon-size - rem-calc($timeline-icon-border-width);
  345. text-align: right;
  346. }
  347. }
  348. // Full width post
  349. .timeline-row-full .timeline-time {
  350. right: 50%;
  351. top: $timeline-icon-border-width;
  352. }
  353. }
  354. }
  355. }