Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <!-- 
https://dribbble.com/shots/2227352-Day-067-Smart-Home-UI/attachments/414148
-->

<div class="wrapper">
	
	<div class="flex">
		<div class="info">
			<h2 class="info__title">Paul's Home</h2>
			<div class="info__time">5:21 PM</div>
		</div>
		<div class="menu">
			<ul class="menu__list">
				<li class="menu__item menu__item--active">Activity</li>			
				<li class="menu__item">Settings</li>
			</ul>
			<div class="flex">
				<div class="menu-border  one-half"></div>
			</div>
		</div>
	</div>
	
	<div class="statistics">
		<div class="consumption-panel">
			<div class="flex flex--justify-between">
				<p>
					Total Consumption				
				</p>
				<a href="/" onclick="return false;">PAY</a>
			</div>
			<h1 class="consumption">79 KWH ~ $89.90</h1>
			<svg id="visualisation" width="600" height="100"></svg>
			
			<p class="title">Rooms Consumption</p>
			<div class="bar-chart">
				
				<div class="progress progress--vertical">
					<div class="progress__fill" style="height: 87%"></div>
					<p class="progress__caption">Study</p>					
				</div>
				
				<div class="progress progress--vertical">
					<div class="progress__fill" style="height: 50%"></div>
					<p class="progress__caption">Bedroom</p>					
				</div>
				
				<div class="progress progress--vertical">
					<div class="progress__fill" style="height: 64%"></div>
					<p class="progress__caption">Kitchen</p>					
				</div>
				
				<div class="progress progress--vertical">
					<div class="progress__fill" style="height: 78%"></div>
					<p class="progress__caption">Living</p>					
				</div>
				
				<div class="progress progress--vertical">
					<div class="progress__fill" style="height: 30%"></div>
					<p class="progress__caption">Bathroom</p>					
				</div>				

			</div>
		</div>
		
		<div class="flex-1">
			<ul class="lamps__list">
				
				<li class="lamps__item  lamps__total">
					<h2 class="lamps__count">15</h2>
					<p class="lamps__description">Total Lamps</p>
				</li>
				
				<li class="lamps__item  lamps__active">
					<h2 class="lamps__count">4</h2>
					<p class="lamps__description">Active Lamps</p>
				</li>
				
			</ul>	
			<div class="temperature">
				<h4 class="title">General Temperature</h4>
				<div class="flex flex--justify-between">
					
					<div class="one-half">
						<div class="temperature__reading">
							23° C						
						</div>
						<div class="temperature__description">
							Current						
						</div>
						<button class="button">Cooler</button>
					</div>
					
					<div class="one-half">
						<div class="temperature__reading">
							21° C						
						</div>
						<div class="temperature__description">
							Target						
						</div>
						<button class="button">Warmer</button>
					</div>	
					
				</div>
			</div> <!-- /.temperature -->
		</div> <!-- /.right-column -->
	</div> <!-- /.statistics -->
</div>
              
            
!

CSS

              
                @import "bourbon"

// slighter darker blue  
$blue-1: #4577DA
// lighter blue 
$blue-2: #5484E4
// bluish black background 
$background: #17181B
$gray: #E5E5E5
$text__color: lighten(#656D78, 15)

$baseline: 20px
$spacing: 40px

$left-column-width: 60%
$right-column-width: 40%

$bezier: ease-in-out

+keyframes(bars)
	from
		transform: scaleY(0)
	to
		transform: scaleY(1)


	
*
	box-sizing: border-box
	margin: 0



body
	$color: rgba(mix(#333, $background), 0.9)
	background:
		image: linear-gradient(70deg, $color 40%, darken($color, 4) 42%, #4F6DA7 42%)
		repeat: no-repeat	
	min-height: 100vh
	color: $text__color
	font-family: Montserrat
	font-size: 1rem
	line-height: 1.5
	padding: 50px

a
	text-decoration: none
	font-size: 0.9rem

	&:link, &:visited
		color: $blue-2

ul
	list-style-type: none
	padding: 0

h1, h2, h3, h4, h5, h6
	font-weight: normal
	margin: 0



.wrapper
	background: linear-gradient(to right, rgba(mix(#333, $background), 0.9) $left-column-width, $background $right-column-width)
	box-shadow: 0 20px 40px 0 rgba(black, 0.18)	
	margin: 0 auto
	max-width: 801px
	min-width: 800px



/**
 * 1. For IE 
 */
.info
	flex-basis: $left-column-width
	max-width: $left-column-width /* [1] */
	padding: 50px 50px
	

// The title an time 
.info__title
	font-size: 1.75rem
	font-weight: normal
	color: white
	line-height: 1.25rem
	padding: 0
	margin-bottom: 10px
	width: 100%

.info__time
	font-size: 1.125rem





.menu
	flex: 1
	padding: ($baseline * 2.5) $spacing

.menu__list
	display: flex
	position: relative
	justify-content: space-between

.menu__item
	color: $text__color	
	cursor: pointer
	font-size: 1.25rem !important
	padding-bottom: ($baseline / 2)
	position: relative
	width: 50%
	transition: color 0.2s $bezier

	&--active
		color: rgba(white, 0.9)
		filter: drop-shadow(1px 1px 8px rgba(white, 0.1))
	

.menu-border
	$color: mix($blue-2, white, 50)
	transform: translateX(0%)
	transition: transform 0.1s $bezier
	width: 100%

	&:after
		background-color: $color
		box-shadow: 0 0px 14px 0 $color
		content: ''
		height: 2px
		width: 20px
		+position(absolute, 0)
		


.statistics
	$subtract: 20px
	background-color: white	
	box-shadow: 0 20px 70px 4px rgba(black, 0.15)
	display: flex
	transform: translate(-$subtract, -$subtract)
	width: 100%



.consumption-panel
	width: $left-column-width - 7
	padding: 50px



.consumption
	color: darken($text__color, 30)



.axis path 
	fill: none
	stroke: #777
	shape-rendering: crispEdges

.axis text
	font-size: 13px

#visualisation
	border-bottom: 1px solid darken($gray, 5)
	max-width: 100%
	min-width: 100%
	margin-bottom: 20px
	width: 100%



.bar-chart
	display: flex
	justify-content: space-between

.progress
	align-items: flex-end
	background-color: $gray
	display: flex
	height: 150px
	position: relative
	width: 35px

.progress__fill
	background-color: $blue-2
	height: 0%
	position: relative
	transform: scaleY(0)
	transform-origin : 50% 100%
	width: 100%
	+animation(bars 1.5s $bezier forwards)
	
.progress__caption
	bottom: -($baseline * 2)
	font-size: 0.75rem
	left: 50%
	position: absolute
	transform: translateX(-50%)



.lamps__list
	display: flex
	text-align: center

.lamps__item
	padding: 80px 0
	
.lamps__count
	color: rgba(white, 0.9)
	font-size: 4rem
	margin-bottom: 20px
	line-height: 1

.lamps__description
	color: rgba(white, 0.6)
	
.lamps__total
	background-color: $blue-1
	flex: 1
	
.lamps__active
	background-color: $blue-2
	flex: 1



.temperature
	border-left: 1px solid $gray	
	padding: $spacing

.temperature__reading
	color: darken($text__color, 25)
	font-size: 2rem

.temperature__description
	margin-bottom: $baseline



.title
	margin-bottom: $baseline



.button
	background-color: $gray
	border: 0
	border-radius: 2px
	color: darken($text__color, 20)
	display: inline-block
	font-size: 1rem
	outline: 0
	padding: ($baseline / 2.5)
	margin-bottom: $baseline
	min-width: 140px
	text-align: center
	


// Helper classes
.flex
	display: flex

.flex-1
	flex: 1

.flex--justify-between
	justify-content: space-between

.one-half
	width: 50%
              
            
!

JS

              
                'use strict';


var menuItems = document.querySelectorAll('.menu__item');

Array.prototype.slice.call(menuItems, 0)
	.forEach(function (item) {
		item.addEventListener('click', onMenuItemClick)
	});

var menuBorder = document.querySelector('.menu-border');

function onMenuItemClick() {
	var parent = this.parentNode;
	var children = Array
		.prototype
		.slice.call(parent.children, 0);
	var index = children.indexOf(this);
	var transform = `translateX(${index * 100}%)`;
	
	children
			.forEach((menuItem) => 
							 menuItem
							 .classList
							 .remove('menu__item--active'));
	this.classList.add('menu__item--active');
	
	menuBorder.style.transform = transform;
}

/*
var progressBars = document.querySelectorAll('.progress__fill');
Array.prototype.slice.call(progressBars, 0)
.forEach(function (item) {
	item.style.height = item.dataset.fill;
});
*/



/**
 * Trying to do graph stuff here 
 */
var data = [{
    y: "60",
    x: "1"
}, {
    y: "80",
    x: "2"
}, {
    y: "61",
    x: "3"
}, {
    y: "90",
    x: "4"
}, {
    y: "50",
    x: "5"
}, {
    y: "70",
    x: "6"
}, {
    y: "90",
    x: "7"
}, {
    y: "70",
    x: "8"
}, ];



var svg = d3.select('#visualisation');
var WIDTH = 600;
var HEIGHT = 100;
var MARGINS = {
	top: 0,
	right: 0,
	bottom: 0,
	left: 0
};

var xScale = d3.scale.linear()
		.range([MARGINS.left, WIDTH - MARGINS.right])
		.domain([1,12]);

var yScale = d3.scale.linear()
		.range([HEIGHT - MARGINS.top, MARGINS.bottom])
		.domain([0,150]);

var xAxis = d3.svg.axis()
		.scale(xScale)
	.orient("bottom");

var yAxis = d3.svg.axis()
		.scale(yScale)
		.orient("left");



var lineGen = d3.svg.line()
  .x(function(data) {
    return xScale(data.x);
  })
  .y(function(data) {
    return yScale(data.y);
  })

var path = svg.append('svg:path')
  .attr('d', lineGen(data))
  .attr('stroke', 'gray')
  .attr('stroke-width', 1)
  .attr('fill', 'none');

var totalLength = path.node().getTotalLength();

path
		.attr("stroke-dasharray", totalLength + " " + totalLength)
		.attr("stroke-dashoffset", totalLength)
		.transition()
			.duration(1500)
			.ease("ease-in-out-quad")
			.attr("stroke-dashoffset", 0);


              
            
!
999px

Console