Skip to content

Instantly share code, notes, and snippets.

@sohailmahmud
Created April 4, 2020 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sohailmahmud/d6af4e6a69fc492269b9d994cb00575b to your computer and use it in GitHub Desktop.
Save sohailmahmud/d6af4e6a69fc492269b9d994cb00575b to your computer and use it in GitHub Desktop.
Process Timeline
<!-- Based on: https://dribbble.com/shots/5260798-Process -->
<div class="toggle">
<span>☀️</span>
<input type="checkbox" id="toggle-switch" />
<label for="toggle-switch"></label>
<span>🌙</span>
</div>
<div class="main-container">
<div class="steps-container">
<div class="step completed">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" />
</svg>
<div class="label completed">
Prospect
</div>
<div class="icon completed">
<i class="far fa-handshake"></i>
</div>
</div>
<div class="line completed"></div>
<div class="step completed">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" />
</svg>
<div class="label completed">
Tour
</div>
<div class="icon completed">
<i class="far fa-map"></i>
</div>
</div>
<div class="line next-step-in-progress">
</div>
<div class="step in-progress">
<div class="preloader"></div>
<div class="label loading">
Offer
</div>
<div class="icon in-progress">
<i class="far fa-money-bill-alt"></i>
</div>
</div>
<div class="line prev-step-in-progress"></div>
<div class="step">
<div class="label">
Contract
</div>
<div class="icon">
<i class="far fa-newspaper"></i>
</div>
</div>
<div class="line"></div>
<div class="step">
<div class="label">
Settled
</div>
<div class="icon">
<i class="fas fa-home"></i>
</div>
</div>
</div>
</div>
const toggleSwitch = document.getElementById('toggle-switch');
toggleSwitch.onchange = (e) => {
document.documentElement.classList.toggle('dark-mode');
}
@import url('https://fonts.googleapis.com/css?family=Muli:700');
:root {
--background-modal-color: #fff;
--body-color: #fff;
--color-timeline-default: #D2D3D8;
--color-step-completed: #5C6174;
--color-checkmark-completed: #fff;
--color-in-progress: #13CB8F;
--color-label-default: var(--color-timeline-default);
--color-label-completed: var(--color-step-completed);
--color-label-loading: var(--color-in-progress);
--color-icon-completed: var(--color-step-completed);
--color-icon-default: var(--color-timeline-default);
&.dark-mode {
--color-checkmark-completed: #fff;
--background-modal-color: #5C6174;
--color-timeline-default: #9799A3;
--color-checkmark-completed: var(--background-modal-color);
--body-color: #fff;
--color-step-completed: #fff;
}
}
* {
box-sizing: border-box;
}
body {
font-family: 'Muli', sans-serif;
background: var(--body-color);
padding: 0;
margin: 0;
display: flex;
width: 100vw;
height: 100vh;
justify-content: center;
align-items: center;
position: relative;
// TOGGLE SWITCH - https://codepen.io/stefen/pen/VNVaYW
.toggle {
transform: scale(0.8);
position: absolute;
bottom: 30px;
display: flex;
align-items: center;
justify-content: space-around;
max-width: 140px;
span {
margin: 0 0.5rem;
}
input[type="checkbox"] {
height: 0;
width: 0;
visibility: hidden;
&:checked + label {
background: #13CB8F;
}
&:checked + label:after {
left: calc(100% - 2px);
transform: translateX(-100%);
}
}
label {
cursor: pointer;
width: 75px;
height: 34px;
background: #D2D3D8;
display: block;
border-radius: 40px;
position: relative;
&:after {
content: "";
position: absolute;
top: 2px;
left: 2px;
width: 30px;
height: 30px;
background: #fff;
border-radius: 40px;
transition: 0.3s;
}
}
}
.main-container {
display: flex;
flex-direction: column;
justify-content: center;
transition: all 200ms ease;
background: var(--background-modal-color);
height: 220px;
min-width: 420px;
max-width: 750px;
flex-grow: 1;
border-radius: 5px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.14);
.steps-container {
padding: 40px;
position: relative;
display: flex;
align-items: center;
justify-content: center;
.step {
z-index: 1;
position: relative;
display: flex;
align-items: center;
justify-content: center;
transition: all 200ms ease;
flex-grow: 0;
height: 15px;
width: 15px;
border: 4px solid var(--color-timeline-default);
border-radius: 50%;
.preloader, svg {
display: none;
}
&.completed {
width: 18px;
height: 18px;
background: var(--color-step-completed);
border: none;
svg {
transition: all 200ms ease;
display: block;
height: 10px;
width: 10px;
fill: var(--color-checkmark-completed);
}
}
&.in-progress {
width: 18px;
height: 18px;
background: var(--color-in-progress);
border: none;
.preloader {
display: block;
height: 10px;
width: 10px;
border: 2px solid #fff;
border-radius: 50%;
border-left-color: transparent;
animation-name: spin;
animation-duration: 2000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
}
.label {
position: absolute;
top: 30px;
filter: none;
z-index: 2000;
color: var(--color-label-default);
transition: all 200ms ease;
font-weight: 700;
&.completed {
color: var(--color-label-completed);
}
&.loading {
color: var(--color-label-loading);
}
}
.icon {
font-size: 40px;
position: absolute;
top: -60px;
color: var(--color-icon-default);
transition: color 200ms ease;
&.completed {
color: var(--color-icon-completed);
}
&.in-progress {
color: var(--color-in-progress);
}
}
}
.line {
transition: all 200ms ease;
height: 2px;
flex-grow: 1;
max-width: 120px;
background: var(--color-timeline-default);
&.completed {
background: var(--color-step-completed);
}
&.next-step-uncomplete {
background: linear-gradient(to right, var(--color-step-completed), var(--color-timeline-default));
}
&.next-step-in-progress {
background: linear-gradient(to right, var(--color-step-completed), var(--color-in-progress));
}
&.prev-step-in-progress {
background: linear-gradient(to right,var(--color-in-progress), var(--color-timeline-default));
}
}
}
}
}
@keyframes spin {
from {
transform:rotate(0deg);
}
to {
transform:rotate(360deg);
}
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment