Pen Settings



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


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


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.


<link rel="stylesheet" href="" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<div id="root"></div>



                @import '';
@font-face {
    font-family: "Digital";
    src: url("//");
    src: url("//") format("embedded-opentype"), url("//") format("woff2"), url("//") format("woff"), url("//") format("truetype"), url("//") format("svg");
    margin: 0;
    box-sizing: border-box;
h1 {
    padding: 0.5vh;

#root {
    display: flex;
    height: 90vw;

    margin: auto;
    border-radius: 10px;
    background-color: gray;
    max-width: 400px;
    text-align: center;
    font-family: digital;
    padding: 10px;

i {
    padding: 1vh;
    font-size: 1.5em;
    color: white;


                const Header = () => <h1>Pomodoro Clock</h1>

      /*depending on props break or session, Settimeout generate title*/
      const SetTimer = ({type, value, handleClick}) => (
        <div className = 'SetTimer'>
          <div id={`${type}-label`}>{`${type == 'session' ? 'Session ': 'Break '}Length`}</div>
            <div className = 'SetTimer-controls'>
              <a id={`${type}-decrement`} onClick={() => handleClick(false,`${type}Value`)}><i className="fas fa-minus-circle"></i></a>
              <h1 id={`${type}-length`}>{value}</h1>
              <a id={`${type}-increment`} onClick={() => handleClick(true, `${type}Value`)}><i className="fas fa-plus-circle"></i></a>

      /*conditional output*/
      const Timer = ({mode, time }) =>(
        <div className='Timer'>
          <h1 id="timer-label">{mode == 'session' ? 'Session' : 'Break'}</h1>
          <h1 id="time-left">{time}</h1>

      /*contorls rendering buttons for pause start reset*/
      const Controls = ({active, handleReset, handlePlayPause}) => (
        <div className='Controls'>
          <a id="start_stop" onClick = {handlePlayPause}>
            {active ? <span><i className="fas fa-pause-circle"></i></span>:<span><i className="fas fa-play"></i></span>}
          <a id="reset" onClick= {handleReset}><i className="fas fa-redo"></i></a>

      class App extends React.Component {
      constructor(props) {
          this.state = {
            breakValue: 5,
            sessionValue: 25,
            time: 25*60*1000, //25min
            active: false,
            touched: false

        componentDidUpdate(prevProps, prevState){
            if(prevState.time === 0 && prevState.mode === 'session'){
                this.setState({time : this.state.breakValue * 60 * 1000, mode: 'break'})
            if(prevState.time === 0 && prevState.mode === 'break'){
              this.setState({time : this.state.sessionValue * 60 * 1000, mode: 'session'})

        handleReset = ()=> {
          this.setState({ breakValue: 5, sessionValue: 25, time: 25*60*1000,mode:'session', active: false, touched: false})

 = 0

        handlePlayPause = () => {
          //if active is true (pause button) then stop timer, and show play button
              this.setState({active: false})
          //if active is false (play) then check for touched state
          } else {
              //if touched is true continue to countdown and set active to pause
                  this.pomodoro = setInterval(() => this.setState({time: this.state.time - 1000}), 1000);
                  this.setState({active: true})
              //if touchen is false set users session(not a default), and start countdown, touched true active(pause button)
              }else {
                      time: this.state.sessionValue *60 * 1000, 
                      touched: true, 
                      active: true}, ()=>this.pomodoro = setInterval(() => this.setState({time: this.state.time - 1000}), 1000))

        handleSetTimers = (inc, type) =>{
          //stop function if state is of type is 60 and add button was clicked
          if(this.state[type] == 60 && inc) return
          //stop function if state is of type is 1 and minus button was clicked
          if(this.state[type] == 1 && !inc) return
          //change state from type break / session, same type state if it is currently inc true add increment for one if false decrement for one
          this.setState({ [type] : this.state[type] + (inc ? 1: -1) })

        render() {
          return (
            <div id="pomodoroBody">
              <Timer mode= {this.state.mode} time ={moment(this.state.time).format('mm:ss')}/>


              <div className= 'settings'>
                <SetTimer type = 'break' value = {this.state.breakValue} handleClick = {this.handleSetTimers}/>
                <SetTimer type = 'session' value = {this.state.sessionValue} handleClick = {this.handleSetTimers}/>
              <audio id='beep' 
                //reference to actual DOM element
                ref = {ref => = ref}>

      ReactDOM.render(<App date={new Date()} /> ,document.getElementById('root'));