JSFiddle - React, Tailwind, and code Playground
by fffam
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.5.1/moment.min.js"></script>
<div class="wrapper">
<div class="pointer">
<span class="server"><strong>Server time</strong><span>00:00</span></span>
<span class="local"><strong>Your time</strong><span>00:00</span></span>
</div>
</div>
CSS
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400, 700);
body {
font-family:'Open Sans', sans-serif;
font-size: 14px;
color: #333;
}
.wrapper {
position: relative;
padding-top: 2em;
}
.pointer {
position: absolute;
height: 4000%;
border-left: 2px solid red;
z-index:400;
top: 0;
transition: left 1s ease-in-out;
}
.pointer .server {
position: absolute;
left: 0;
background: red;
color: white;
font-size: 0.8em;
font-weight: bold;
padding: 4px 6px;
margin-left: -2px;
}
.pointer .local {
position: absolute;
right: 2px;
background: #B6B6B6;
color: white;
font-size: 0.8em;
font-weight: bold;
padding: 4px 6px;
margin-left: 0px;
}
.pointer .server strong {
position: absolute;
top: 2.1em;
color: #B9B9B9;
left: 6px;
width: 10em;
}
.pointer .local strong {
position: absolute;
top: 2.1em;
color: #B9B9B9;
right: 6px;
width: 10em;
text-align: right;
}
.bar {
display: flex;
flex-wrap: nowrap;
}
h2 {
font-size: 1em;
font-weight: bold;
width: 100%;
margin: 0.25em 0;
color: #AAA;
}
.bar > div {
box-sizing: border-box;
padding: 0.5em;
font-size: 0.8em;
position: relative;
font-weight: bold;
}
.bar > div > span {
display: inline-block;
padding: 0px 0 2px 0;
margin: 2px;
color: rgba(0,0,0,0.6);
font-weight: normal;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.bar > div > strong {
display: block;
}
}
JavaScript
// Information on all the map metas
// Each has a name and a list of phases, with
// each phase having an offset from the previous phase
// (or start of every even hour for the first phase per meta)
// using server time (UTC)
var metas = {
vb: {
name: "Verdant Brink",
phases: [
{ name: "", duration: 10, color: "#84C147" },
{ name: "Night Bosses", duration: 20, color: "#6DAC2F" },
{ name: "Daytime", duration: 75, color: "#C4E2A5" },
{ name: "Night", duration: 15, color: "#84C147" },
]
},
ab: {
name: "Auric Basin",
phases: [
{ name: "Pillars", duration: 45, color: "#FFE37F" },
{ name: "Challenges", duration: 15, color: "#FFD53D" },
//{ name: "", duration: 5, color: "#FFE37F" },
{ name: "Octovine", duration: 20, color: "#EAB700" },
{ name: "Reset", duration: 10, color: "#FFF1C1" },
{ name: "Pillars", duration: 30, color: "#FFE37F" },
]
},
td: {
name: "Tangled Depths",
phases: [
{ name: "", duration: 25, color: "#FFD7D7" },
{ name: "Prep", duration: 5, color: "#ffbdbd" },
{ name: "Chak Gerent", duration: 20, color: "#f99" },
{ name: "Help the Outposts", duration: 70, color: "#FFD7D7" },
]
},
ds: {
name: "Dragon's Stand",
phases: [
{ name: "", duration: 90, color: "linear-gradient( 90deg, #c8c5e5, #DFDDF7 )" },
{ name: "Start", duration: 30, color: "linear-gradient( 90deg, #9f99cc, #c8c5e5 )" }
]
},
dt: {
name: "Dry Top",
phases: [
{ name: "Crash Site", duration: 40, color: "#FCFADC" },
{ name: "Sandstorm", duration: 20, color: "#DED98A" },
{ name: "Crash Site", duration: 40, color: "#FCFADC" },
{ name: "Sandstorm", duration: 20, color: "#DED98A" }
]
}
...