Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <link href="https://fonts.googleapis.com/css?family=Asap|Baloo|Cinzel|Lobster" rel="stylesheet">

<header>
	<img src="http://circleofdocs.com/wp-content/uploads/2015/12/icon256.png" />
	<h1>Pomodoro Clock</h1>	
</header>

<div class="configGroups">
	<div class="configs green">
		<div class="title">
			Break Lenght
		</div>
		<div class="formButtons">
			<input id="break" value="5" type="number"/>
			<div class="buttons">
				<buttom onclick="add('break')">+</buttom>
				<buttom onclick="remove('break')">-</buttom>
			</div>
		</div>
	</div>

	<div class="configs red">
		<div class="title">
			Session Lenght
		</div>
		<div class="formButtons">
			<input id="session" type="number" value="25" />
			<div class="buttons">
				<buttom onclick="add('session')">+</buttom>
				<buttom onclick="remove('session')">-</buttom>
			</div>
		</div>
	</div>
</div>

<div class="clock" id="divClock">
	<input id="clock" type="text" value="00:00" disabled />
</div>

<div class="actions">
	<buttom onclick="start()">Start</buttom>
	<buttom onclick="reset()">Reset</buttom>
</div>

<footer>Designed & Coded by 
  <span>Nurielly Caroline Brizola</span>
  <div class="icons">
    <a href="https://codepen.io/nurycaroline/">
      <i class="fa fa-codepen"></i>
    </a>
    <a href="https://github.com/nurielly">
      <i class="fa fa-github"></i>
    </a>
    <a href="https://www.facebook.com/NuriellyCaroline">
      <i class="fa fa-facebook"></i>
    </a>
    <a href="https://br.linkedin.com/in/nurielly-caroline-brizola-b2693a40"> <i class="fa fa-linkedin" aria-hidden="true"></i> </a>
  </div>
</footer>
              
            
!

CSS

              
                $red: #E53D31;
$green: #57D52B;
$colors: (red: $red, green: $green);

@mixin configs-input-color($color) {
	border: 2px solid $color;
	color: $color;
}
@mixin configs-buttons-color($color) {
	color: $color;
}
@mixin configs-buttons-bg-border($color){
	background-color: $color;
	border: 2px solid $color;
	margin-left: 1px;
}

header {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: center;
}

img {
	width: 100px;
	height: 100px;
}

h1 {
	font-size: 70px;
	font-family: 'Lobster', cursive;
}

input {
	font-family: 'Cinzel', serif;
	background-color: #fff;
	font-size: 55px;
	height: 60px;
	width: 145px;
	padding-left: 10px;
}

buttom {
	width:20px;
	padding: 4.2px;
	font-size: 20px;
	text-align: center;
	font-family: 'Baloo', cursive;
	margin-bottom: 1px;
	cursor: pointer;
}

.configGroups {
	display: flex;
  flex-direction: row;
  justify-content: space-around;
	margin-left: auto;
	margin-right: auto;
	margin-top: 20px;
}


.configs {
	display: flex;
	flex-direction: column;
	font-family: 'Cinzel', serif;
	
	.title {
		width: 100%;
		text-align:center;
		font-size: 20px;
		font-weight: bold;
	}
	
	.formButtons{
		display: flex;
	}
	
	.buttons{
		display: flex;
		flex-direction: column;
	}
}

@each $chave, $color in $colors {
  .configs.#{$chave} input{
	@include configs-input-color($color);
  }
}

.configs.green buttom{
	@include configs-buttons-color($red);
	@include configs-buttons-bg-border($green);
}
.configs.red buttom{
	@include configs-buttons-color($green);
	@include configs-buttons-bg-border($red);
}

.actions {
	display: flex;
	justify-content: space-around;
	margin-left: auto;
	margin-right: auto;
	margin-top: 25px;
	
	buttom{
		box-shadow: 0.2em 0 0.4em $red;
		width: 100px;
		padding: 15px;
		@include configs-buttons-color(#fff);
		@include configs-buttons-bg-border($red);
	}
}


/*   --- Clock ---   */
.clock {
	margin: 15px auto 15px auto;
	width: 200px;
	height: 200px;
	border-radius: 100%;
	border: 20px solid $green;
	box-shadow: 0.2em 0 0.4em $red;
	background-color: $red;
	text-align: center;
	align-items: center;
	display: flex;
	justify-content: center;

	input {
		height: 60px;
		width: 145px;
		border: none;
		background-color: $red;
		color: #fff;
		text-align: center;
		font-size: 55px;
		font-weight: bold;
	}
}

.clock.break {
	border: 20px solid $red;
	box-shadow: 0.2em 0 0.4em $green;
	background-color: $green;
	
	input {
		background-color: $green;
	}
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

footer{
  text-align: center;
  margin-top: 30px;
  
  span{
    color: $red;  
    font-weight: bold;
  }
  
  .fa {
    color: $green;
  }
}
              
            
!

JS

              
                var interval;

add = (elementId) => {
    let element = document.getElementById(elementId);
	element.value = +element.value + 1; 
};

remove = (elementId) => {
    let element = document.getElementById(elementId);
	element.value = +element.value - 1;
};

reset = () => {
	document.getElementById('divClock').className = "clock";
	start();
};

updateClock = (second, minute) => {
	let seconds = second < 10 ?  `0${second}` : second; 
	let minutes = minute < 10 ? `0${minute}` : minute; 
	document.getElementById('clock').value = `${minutes}:${seconds}`;
};

breakInterval = () => {
	window.clearInterval(interval);
	let minute = +document.getElementById('break').value - 1;
	let second = 59;

	interval = window.setInterval(() => {
		if (second == 0) { 
			minute--;
			second = 59; 
		}
		updateClock(second, minute);
		second--;
		if (minute == 0 && second == 0){
			window.clearInterval(interval);
		}
	}, 1000);
};

start = () => {
	window.clearInterval(interval);
	let minute = +document.getElementById('session').value - 1;
	let second = 59;

	interval = window.setInterval(() => {
		if (second == 0) { 
			minute--;
			second = 59; 
		}

		updateClock(second, minute);						
		second--;
		if (minute == 0 && second == 0){
			document.getElementById('divClock').className = "clock break";
			breakInterval();
		}
	}, 1000);
};
              
            
!
999px

Console