123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- /* ------------------------------------------------------------------------------
- *
- * # Timeline
- *
- * Styles for timeline in 3 layouts: left, right and centered
- *
- * ---------------------------------------------------------------------------- */
- // Check if component is enabled
- @if $enable-timeline {
- // Base
- .timeline {
- position: relative;
- // Dots base
- &:before,
- &:after {
- content: "";
- position: absolute;
- left: 50%;
- margin-left: -($timeline-line-width);
- background-color: $timeline-line-color;
- z-index: 1;
- @include size($timeline-line-width * 2);
- @include border-radius($border-radius-circle);
- }
- // Top dot
- &:before {
- top: 0;
- }
- // Bottom dot
- &:after {
- bottom: 0;
- }
- }
- // Container
- .timeline-container {
- position: relative;
- padding-top: ($spacer / 2);
- margin-top: -($spacer / 2);
- padding-bottom: 1px;
- // Vertical line
- &:after {
- content: "";
- position: absolute;
- top: 0;
- left: 50%;
- margin-left: -($timeline-line-width / 2);
- background-color: $timeline-line-color;
- height: 100%;
- width: $timeline-line-width;
- z-index: -1;
- }
- }
- // Row
- .timeline-row {
- position: relative;
- }
- // Date
- .timeline-date {
- text-align: center;
- background-color: $body-bg;
- position: relative;
- z-index: 1;
- padding-top: $spacer;
- padding-bottom: $spacer;
- margin-bottom: $spacer;
- // Dots base
- &:before,
- &:after {
- content: "";
- position: absolute;
- left: 50%;
- margin-left: -($timeline-line-width);
- background-color: $timeline-line-color;
- z-index: 1;
- @include size($timeline-line-width * 2);
- @include border-radius($border-radius-circle);
- }
- // Top dot
- &:before {
- top: 0;
- }
- // Bottom dot
- &:after {
- bottom: 0;
- }
- // Change bg color to card bg if inside card
- .card & {
- background-color: $card-bg;
- }
- }
- // Time
- .timeline-time {
- text-align: center;
- padding-top: $spacer;
- padding-bottom: $spacer;
- background-color: $body-bg;
- position: relative;
- margin-bottom: $spacer;
- // Dots base
- &:before,
- &:after {
- content: "";
- position: absolute;
- left: 50%;
- margin-left: -($timeline-line-width);
- background-color: $timeline-line-color;
- @include size($timeline-line-width * 2);
- @include border-radius($border-radius-circle);
- }
- // Top dot
- &:before {
- top: 0;
- }
- // Bottom dot
- &:after {
- bottom: 0;
- }
- // Change bg color to card bg if inside card
- .card & {
- background-color: $card-bg;
- }
- // Hide dots no desktop
- @include media-breakpoint-up(md) {
- &:before,
- &:after {
- content: none;
- }
- }
- }
- // Icon and image
- .timeline-icon {
- margin: 0 auto $spacer auto;
- background-color: $timeline-icon-bg;
- border: $timeline-icon-border-width solid $body-bg;
- @include size($timeline-icon-size);
- @include border-radius($border-radius-circle);
- // Change border color if it's inside card
- .card & {
- border-color: $card-bg;
- }
- // Icon
- div {
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- box-shadow: 0 0 0 $timeline-line-width $timeline-line-color inset;
- @include border-radius($border-radius-circle);
- // Hide border if icon wrapper has dark color
- &[class*=bg-]:not(.bg-white):not(.bg-light):not(.bg-transparent) {
- box-shadow: none;
- }
- // Icon
- > i {
- top: 0;
- }
- }
- // Image
- img {
- @include size($timeline-icon-size - rem-calc($timeline-icon-border-width * 2));
- @include border-radius($border-radius-circle);
- }
- }
- //
- // Responsive config
- //
- @include media-breakpoint-up(md) {
- // Positions
- // ------------------------------
- // Center layout
- .timeline-center {
- // Left blocks
- .timeline-row-left {
- margin-right: 50%;
- padding-right: $timeline-icon-size - rem-calc($timeline-icon-border-width);
- }
- // Right blocks
- .timeline-row-right {
- margin-left: 50%;
- padding-left: $timeline-icon-size - rem-calc($timeline-icon-border-width);
- }
- }
- // Left layout
- .timeline-left {
- // Vertical line
- .timeline-container:after,
- &:before,
- &:after,
- .timeline-date:before,
- .timeline-date:after {
- left: ($timeline-icon-size / 2);
- }
- // Content padding
- .timeline-row,
- .timeline-date {
- padding-left: ($timeline-icon-size + $timeline-content-padding-x);
- }
- }
- // Right layout
- .timeline-right {
- // Vertical line
- .timeline-container:after,
- &:before,
- &:after,
- .timeline-date:before,
- .timeline-date:after {
- left: auto;
- right: ($timeline-icon-size / 2);
- margin-left: 0;
- margin-right: -($timeline-line-width);
- }
- .timeline-container:after {
- margin-right: -($timeline-line-width / 2);
- }
- // Content padding
- .timeline-row,
- .timeline-date {
- padding-right: ($timeline-icon-size + $timeline-content-padding-x);
- }
- }
- // Reduce date vertical spacing in both
- .timeline-left .timeline-date,
- .timeline-right .timeline-date {
- padding-top: ($spacer / 2);
- padding-bottom: ($spacer / 2);
- }
- // Icon
- // ------------------------------
- // Base
- .timeline-icon {
- position: absolute;
- top: ($spacer / 2);
- // Horizontal line base
- &:after {
- content: "";
- position: absolute;
- top: 50%;
- margin-top: -($timeline-line-width / 2);
- height: $timeline-line-width;
- width: ($timeline-icon-size / 2) - rem-calc($timeline-icon-border-width * 2);
- background-color: $timeline-line-color;
- z-index: 1;
- }
- }
- // In left layout
- .timeline-left {
- .timeline-icon {
- left: 0;
- // Right line
- &:after {
- left: 100%;
- margin-left: $timeline-icon-border-width;
- }
- }
- }
- // In right layout
- .timeline-right {
- .timeline-icon {
- right: 0;
- // Left line
- &:after {
- right: 100%;
- margin-right: $timeline-icon-border-width;
- }
- }
- }
- // In centered layout
- .timeline-center {
- // In left block
- .timeline-row-left {
- .timeline-icon {
- left: 100%;
- margin-left: -($timeline-icon-size / 2);
- // Left horizontal line
- &:after {
- right: 100%;
- margin-right: $timeline-icon-border-width;
- }
- }
- }
- // In right block
- .timeline-row-right {
- .timeline-icon {
- right: 100%;
- margin-right: -($timeline-icon-size / 2);
- // Right horizontal line
- &:after {
- left: 100%;
- margin-left: $timeline-icon-border-width;
- }
- }
- }
- // Full width post
- .timeline-row-full .timeline-icon {
- position: static;
- // Remove horizontal line
- &:after {
- content: none;
- }
- }
- }
- // Time
- // ------------------------------
- .timeline-time {
- padding: 0;
- text-align: inherit;
- background-color: transparent;
- // Hide dots
- &:before {
- content: none;
- }
- }
- // In left and right layouts
- .timeline-left,
- .timeline-right {
- .timeline-time {
- padding-top: ($spacer / 2);
- margin-bottom: $spacer;
- padding-left: ($timeline-content-padding-x / 2);
- }
- }
- .timeline-right .timeline-time {
- text-align: right;
- padding-left: 0;
- padding-right: ($timeline-content-padding-x / 2);
- }
- // In center layout
- .timeline-center {
- .timeline-time,
- .timeline-row-full .timeline-time {
- position: absolute;
- left: 100%;
- top: ($spacer / 2) + rem-calc($timeline-icon-border-width);
- width: 100%;
- padding-left: $timeline-icon-size - rem-calc($timeline-icon-border-width);
- }
- // Right aligned post
- .timeline-row-right,
- .timeline-row-full {
- .timeline-time {
- left: auto;
- right: 100%;
- padding-left: 0;
- padding-right: $timeline-icon-size - rem-calc($timeline-icon-border-width);
- text-align: right;
- }
- }
- // Full width post
- .timeline-row-full .timeline-time {
- right: 50%;
- top: $timeline-icon-border-width;
- }
- }
- }
- }
|