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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <div id="app"></div>
              
            
!

CSS

              
                .html
  position relative
  min-height 100%
body
  margin-bottom 60px
.footer
  position absolute
  bottom 0
  width 100%
  height 60px
  background-color #f5f5f5
	
.text-footer
  margin 20px 0

// http://paletton.com/#uid=13h050kQbgmXbazUedAEjhZsrh3
$btncolor = #005754
$btncolordisabled = #AAA
.btn-container
	display flex
	font-weight bold
	align-items center
	justify-content center
	border-radius 40px
	background-color white
	color $btncolor
	border-style solid
	border-width 2px
	border-color $btncolor
	height 40px
	width 40px

.disabled
	border-color $btncolordisabled
	color $btncolordisabled

// Pomodoro interface
.controllers
	display flex
	justify-content space-around

.controllersContainer
	display flex
	flex-direction column
	align-items center

.buttonsContainer
	display flex
	align-items center
.controllerTag
	font-size 135%
.breaktext
	font-size 250%
	margin 0px 10px
.pmdcontainer
	display flex
	align-items center
.pmdtext
	font-size 250%
	margin 0px 10px

.timerContainer
	display flex
	align-items center
	justify-content center
.pomodoroTimerContainer
	display flex
	flex-direction column
	align-items center
	justify-content center
	margin 60px 0px
	min-width 300px
	height 300px
	border-radius 300px
	border-style solid
	border-width 3px
	border-color #004f4c
.pomodoroTimer
	font-size 500%

.pomodoroTag
	font-size 150%
              
            
!

JS

              
                const Navbar = React.createClass({
	propTypes: {
		brand: React.PropTypes.string.isRequired
	},
	getDefaultProps: function() {
		return {
			brand: "Title",
			color: "default"
		};
	},
	render: function() {
		return (
			<nav className={"navbar navbar-" + this.props.color}>
				<div className="container-fluid">
					<div className="navbar-header">
						<button
							type="button"
							className="navbar-toggle collapsed"
							data-toggle="collapse"
							data-target="#bs-example-navbar-collapse-1"
							aria-expanded="false"
							>
							<span className="sr-only">Toggle navigation</span>
							<span className="icon-bar" />
							<span className="icon-bar" />
							<span className="icon-bar" />
						</button>
						<a className="navbar-brand" href="#">{this.props.brand}</a>
					</div>
					<div
						className="collapse navbar-collapse"
						id="bs-example-navbar-collapse-1"
						>
						<ul className="nav navbar-nav">
							<li><a href="#">Home</a></li>
							<li><a href="#">About</a></li>
						</ul>
					</div>
				</div>
			</nav>
		);
	}
});

const Footer = React.createClass({
	getDefaultProps: function() {
		return {
			brand: "La Terminal, Inc.",
			year: 2017
		};
	},
	render: function() {
		return (
			<footer className="footer">
				<div className="container">
					<p className="text-muted text-footer">Made with 🍻 by <a href="https://mrcrjs.github.io/" target="_blank">Marco A. Rojas</a></p>
				</div>
			</footer>
		);
	}
});

const Button = React.createClass({
	getInitialState: function() {
		return {
			disabled: this.props.disabled || false
		};
	},
	componentWillReceiveProps: function(nextProps) {
		if (this.props.disabled !== nextProps.disabled)
			this.setState({ disabled: nextProps.disabled });
	},
	render: function() {
		if (this.state.disabled)
			return (
				<button className={"btn-container disabled"}>
					<div> {this.props.symbol}
						{" "}</div>
				</button>
			);
		else
			return (
				<button className={"btn-container"} onClick={this.props.onClick}>
					<div> {this.props.symbol}
						{" "}</div>
				</button>
			);
	}
});

const Pomodoro = React.createClass({
	getInitialState: function() {
		return {
			break: 5,
			pomodoro: 25,
			pmdRunning: false,
			pomodoroState: null,
			timerMins: 0,
			timerSecs: 0
		};
	},
	timer: function() {
		if (this.state.timerMins > 0 || this.state.timerSecs > 0) {
			if (this.state.timerSecs > 0) {
				this.setState({ timerSecs: this.state.timerSecs - 1 });
			} else {
				this.setState({
					timerMins: this.state.timerMins - 1,
					timerSecs: 59
				});
			}
		} else {
			if (this.state.pomodoroState === "pomodoro")
				this.setState({
					pomodoroState: "break",
					timerMins: this.state.break,
					timerSecs: 0
				});
			else
				this.setState({
					pomodoroState: "pomodoro",
					timerMins: this.state.pomodoro,
					timerSecs: 0
				});
		}
	},
	_reduceBreak: function() {
		this.setState({
			break: this.state.break - 1
		});
	},
	_increaseBreak: function() {
		this.setState({
			break: this.state.break + 1
		});
	},
	_reducePomodoro: function() {
		const newPomodoro = this.state.pomodoro - 1;
		if (!this.state.pmdRunning)
			this.setState({
				pomodoro: newPomodoro,
				timerMins: newPomodoro
			});
		else
			this.setState({
				pomodoro: newPomodoro
			});
	},
	_increasePomodoro: function() {
		const newPomodoro = this.state.pomodoro + 1;
		if (!this.state.pmdRunning)
			this.setState({
				pomodoro: newPomodoro,
				timerMins: newPomodoro
			});
		else
			this.setState({
				pomodoro: newPomodoro
			});
	},
	_startPomodoro: function() {
		const secondsInterval = setInterval(this.timer, 1000);
		this.setState({
			timerMins: this.state.pomodoro,
			pmdRunning: true,
			pomodoroState: "pomodoro",
			secondsInterval
		});
	},
	_stopPomodoro: function() {
		this.setState(
			{
				timerMins: this.state.pomodoro,
				timerSecs: 0,
				pomodoroState: null,
				pmdRunning: false
			},
			clearInterval(this.state.secondsInterval)
		);
	},
	render: function() {
		const timerBgColor = this.state.pomodoroState === "pomodoro" ? "#005754" : "#88450F"
		const pomodoroRunningString = this.state.pomodoroState === "pomodoro" ? "Focus on your task" : "Take a break!"
		const timer = !this.state.pmdRunning
		? <div
				className={"timerContainer"}
				onClick={this._startPomodoro.bind(this)}
			><div className={"pomodoroTimerContainer animated pulse"}>
					<span className={"pomodoroTimer"}>
							{this.state.pomodoro < 10
								? "0" + this.state.pomodoro
							: this.state.pomodoro}:{this.state.timerSecs < 10
								? "0" + this.state.timerSecs
							: this.state.timerSecs}
						</span>
						<p className={"pomodoroTag"}>Start pomodoro</p>
					</div>
				</div>
				: <div onClick={this._stopPomodoro.bind(this)} className={"timerContainer"}>
		<div className={"pomodoroTimerContainer animated tada"} style={{ "background-color": timerBgColor, color: "white" }}>
			<span className={"pomodoroTimer"}>
				{this.state.timerMins < 10
								? "0" + this.state.timerMins
							: this.state.timerMins}:{this.state.timerSecs < 10
					? "0" + this.state.timerSecs
				: this.state.timerSecs}
			</span>
			<p className={"pomodoroTag"} style={{color: "white"}}>{ pomodoroRunningString }</p>
			</div>
			</div>;
		return (
			<div className={"pomodoro"}>
				<div className={"controllers"}>
					<div className={"controllersContainer"}>
						<p className={"controllerTag"}>Break Duration</p>
						<div className={"buttonsContainer"}>
							<Button
								symbol={"-"}
								disabled={this.state.break === 1}
								onClick={this._reduceBreak.bind(this)}
								/>
							<span className={"breaktext"}> {this.state.break} </span>
							<Button onClick={this._increaseBreak.bind(this)} symbol={"+"} />
						</div>
						</div>
					<div className={"controllersContainer"}>
						<p className={"controllerTag"}>Pomodoro Duration</p>
						<div className={"buttonsContainer"}>
							<Button
								symbol={"-"}
								disabled={this.state.pomodoro === 5}
								onClick={this._reducePomodoro.bind(this)}
								/>
							<span className={"pmdtext"}> {this.state.pomodoro} </span>
							<Button onClick={this._increasePomodoro.bind(this)} symbol={"+"} />
						</div>
					</div>
				</div>
				{timer}
			</div>
		);
	}
});

const App = React.createClass({
	getInitialState: function() {
		return {
			currentPage: "home"
		};
	},

	render: function() {
		return (
			<div>
				<Navbar
					brand="Pomodoro"
					activePage={this.state.currentPage}
					color="inverse"
					/>
				<br />
				<div className="container-fluid">
					<div className="row">
						<div className="col-md-12">
							<h1>Pomodorus</h1>
							<p className="lead text-muted">
								The Pomodoro method is a productivity technique developed by Francesco Cirillo in the 1990s. Cirillo’s technique is one of the most respected time-management techniques in the world. The goal of the Pomodoro technique is to reduce distraction and increase focus.
							</p>
						</div>
					</div>
					<div className={"row"}>
							<div className={"col-md-12"}>
								<Pomodoro />
							</div>
						</div>
				</div>
				<Footer />
			</div>
		);
	}
});

ReactDOM.render(<App />, document.getElementById("app"));

              
            
!
999px

Console