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 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="root">
</div>

<!-- https://dribbble.com/shots/4223469-Raika-Plant -->

<div class="credit-wrap">
  <p>Loosely based on the design by:</p>
  <a class="credit credit--design" style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px;" href="https://dribbble.com/shots/4223469-Raika-Plant" target="_blank" rel="noopener noreferrer"><span style="display:inline-block;padding:2px 3px;"><svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white;" viewBox="0 0 20 20"><title></title><path d="M7.621,10.267c-0.367,0.404-0.457,0.694-0.938,1.454c0.311,0.217,0.908,0.718,1.322,1.581   c0.827-0.475,1.213-0.547,1.651-0.916c2.862-2.41,9.87-11.049,9.629-11.299C19.032,0.822,10.141,7.503,7.621,10.267z M5.857,12.392   c-1.243-0.22-2.47,0.566-3.289,2.53c-0.82,1.964-2.284,2.75-2.568,2.702c1.528,0.553,6.188,1.967,7.346-3.416   C6.854,12.917,5.857,12.392,5.857,12.392z" fill="#FFFFFF"/></svg></span><span style="display:inline-block;padding:2px 3px;">Nicola Baldo</span></a>
              
            
!

CSS

              
                body {
  font-size: 18px;
  background: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
  background-size: cover;
  min-height: 100vh;
}

.slide {
  // had to use an alternate font
  display: grid;
  width: 90%;
  max-width: 960px;
  margin: 50px auto;
  font-family: "Karla", sans-serif;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: 200px 200px 1fr;
  box-shadow: 0px 60px 95px -30px #3c3c3c;
}

.slide__decorative-sidebar {
  position: relative;
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
  overflow: hidden;

  @media screen and (max-width: 970px) {
    grid-row: 2 / span 1;
    grid-column: 1 / -1;
    display: none;
  }

  &::after {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: #f9f9f9;
    z-index: -1;
  }
}

.slide__decorative-sidebar img {
  display: inline-block;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  opacity: 1;
  transition: all 0.3s linear;
  transform: translateX(0) scale(1);
  

  .slideshow--out & {
    opacity: 0;
    transform: translateX(-50%) scale(1.2);
    
  }

  .slideshow--in & {
    opacity: 0;
    transform: translateX(50%) scale(1.2);
  }
}

.slide__info {
  display: flex;
  position: relative;
  flex-direction: row;
  grid-column: 3 / -1;
  grid-row: 1 / span 2;
  background: linear-gradient(to right, #ebebeb 0%, #f1f1f1 100%);
  overflow: hidden;

  @media screen and (max-width: 970px) {
    grid-column: 1 / -1;
    grid-row: 1 / span 2;
  }
}

.slide__info__text {
  width: 30%;
  margin: 9%;
  z-index: 2;
  opacity: 1;
  transition: all 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);

  .slideshow--out & {
    transform: translateX(-50%);
    opacity: 0;
  }

  .slideshow--in & {
    transform: translateX(50%);
    opacity: 0;
  }

  @media screen and (max-width: 645px) {
    width: 100%;
  }
}

.slide__info__title {
  font-weight: 700;
  font-size: 2em;
  margin-bottom: 0.66em;
}

.slide__info__description {
  line-height: 1.5em;
  color: #606060;
}

.slide__info__image {
  position: absolute;
  bottom: -15%;
  right: 15%;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: all 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);

  @media screen and (max-width: 1180px) {
    right: 10%;
  }

  @media screen and (max-width: 1060px) {
    right: 5%;
  }

  @media screen and (max-width: 960px) {
    right: 0;
  }

  @media screen and (max-width: 775px) {
    transform: translateX(0%);
  }

  @media screen and (max-width: 645px) {
    right: -50%;
  }

  .slideshow--out & {
    opacity: 0;
    transform: translateY(20%) scale(1.1);

    @media screen and (max-width: 775px) {
      transform: translateX(-25%);
    }
  }

  .slideshow--in & {
    opacity: 0;
    transform: translateY(20%) scale(1.1);

    @media screen and (max-width: 775px) {
      transform: translateX(25%);
    }
  }
}

.slide__arrows {
  position: absolute;
  bottom: 0;
  right: 0;
}

.slide__arrows__arrow {
  display: inline-block;
  width: 62.5px;
  height: 60px;
  background-color: #ffc001;
  text-align: center;
  line-height: 60px;
  font-weight: 700;
  cursor: pointer;

  &:hover {
    transform: scale(1.05);
  }
}

.slide__arrows__arrow--disabled {
  background-color: #ffffff;
  cursor: default;

  &:hover {
    transform: scale(1);
  }
}

.slide__count {
  background: #ffffff;
  grid-column: 1 / span 2;
  grid-row: 3 / span 1;
  padding: 15%;

  @media screen and (max-width: 970px) {
    position: relative;
    grid-row: 2 / span 1;
    grid-column: 1 / span 2;
    padding-top: 50px;
    background: transparent;
  }
}

.slide__count__title {
  font-weight: 700;
}

.slide__count__count {
  display: inline-block;
  font-weight: 700;
  font-size: 4em;
  margin-top: 0.5em;
  overflow: hidden;

  @media screen and (max-width: 905px) {
    font-size: 3em;
  }
}

.slide__count__count span {
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);
  opacity: 1;

  .slideshow--out & {
    transform: translateY(100%);
    opacity: 0;
  }

  .slideshow--in & {
    transform: translateY(-100%);
    opacity: 0;
  }
}

.slide__details {
  grid-column: 4 / -1;
  background: #1c1c1c;
  color: #ffffff;
  padding-bottom: 50px;

  @media screen and (max-width: 970px) {
    grid-column: 2 / -1;
    grid-row: 3 / span 1;
    text-align: center;
  }

  @media screen and (max-width: 775px) {
    padding-bottom: 0;
  }
}

.slide__next {
  position: relative;
  // width: 80px;
  height: 100%;
  float: left;
  background: #ffc001;
  color: #1c1c1c;
  font-weight: 700;
  grid-column: 3 / span 1;

  @media screen and (max-width: 970px) {
    grid-column: 1 / span 1;
    grid-row: 3 / span 1;
  }
}

.slide__next span {
  font-size: 0.8em;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotateZ(-90deg);
}

.slide__details__title {
  width: 100%;
  font-weight: 700;
  font-size: 1.3em;
  margin: 2.5em 0 1.3em 50px;

  @media screen and (max-width: 970px) {
    margin-top: 2em;
  }

  @media screen and (max-width: 775px) {
    margin-left: 0;
  }
}

.slide__details__block {
  display: inline-block;
  width: 25%;
  opacity: 1;
  padding-right: 0.5em;
  transition: all 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);

  .slideshow--out & {
    transform: translateY(-75%);
    opacity: 0;
  }

  .slideshow--in & {
    transform: translateY(-75%);
    opacity: 0;
  }

  @media screen and (max-width: 775px) {
    width: 100%;
    margin: 0 auto 2em;
  }
}

.slide__details__block--temp {
  margin-left: 50px;

  @media screen and (max-width: 775px) {
    margin-left: 0;
  }
}

.slide__details__block--water {
  transition-delay: 0.025s;
}

.slide__details__block--nutrition {
  transition-delay: 0.05s;
}

.slide__details__subtitle {
  color: #8d8d8d;
  font-size: 0.8em;
  font-weight: 700;
  margin-bottom: 1em;
}

.slide__details__block__description {
  font-size: 0.8em;
  line-height: 1.3em;
}

.credit-wrap {
  font-family: "Karla", sans-serif;
  width: 100%;
  text-align: center;
}

.credit {
  margin: 1em auto;
}

.credit--design {
}

              
            
!

JS

              
                // bad animation handling. timing is 2x too long

class Slideshow extends React.Component {
  constructor() {
    super();

    this.state = {
      loaded: false,
      animating: false,
      animationDirection: "",
      animationDuration: 300,
      currentSlide: 0,
      slides: [
        {
          title: "Raika",
          imageUrl:
            "https://s3-us-west-2.amazonaws.com/s.cdpn.io/36124/plant1.png",
          description: "An incredible plant to beautify your living room.",
          details: {
            temperature: "70 degrees F day 65 degrees F night",
            water: "Summer: 2 litres Winter: 1 litre",
            nutrition: "Garden loam, perlite, peat moss"
          }
        },
        {
          title: "Another Plant",
          imageUrl:
            "https://s3-us-west-2.amazonaws.com/s.cdpn.io/36124/plant2.png",
          description: "This is another nice plant.",
          details: {
            temperature: "75 degrees F day 62 degrees F night",
            water: "Summer: 3 litres Winter: 1.5 litre",
            nutrition: "A thing, something, other thing"
          }
        }
      ]
    };

    this.changeSlide = this.changeSlide.bind(this);
  }

  fireAnims(duration) {
    this.setState({
      animating: true,
      animationDirection: "out"
    });
    // halfway
    setTimeout(() => {
      this.setState({
        animating: true,
        animationDirection: "in"
      });
    }, duration / 2);
    // done
    setTimeout(() => {
      this.setState({
        animating: false,
        animationDirection: ""
      });
    }, duration);
  }

  changeSlide(dir) {
    const currentSlide = this.state.currentSlide;
    const slides = this.state.slides;

    if (dir === "right") {
      if (currentSlide < slides.length - 1) {
        this.fireAnims(this.state.animationDuration * 2);
        window.setTimeout(() => {
          this.setState({
            currentSlide: currentSlide + 1
          });
        }, this.state.animationDuration);
      }
    } else {
      if (currentSlide > 0) {
        this.fireAnims(this.state.animationDuration * 2);
        window.setTimeout(() => {
          this.setState({
            currentSlide: currentSlide - 1
          });
        }, this.state.animationDuration);
      }
    }
  }

  determineDir(delta) {
    if (delta > 0) {
      return "right";
    } else {
      return "left";
    }
  }

  componentDidMount() {
    this.setState({
      loaded: true
    });
  }
  render() {
    let classes = ["slideshow"];
    if (this.state.animating) {
      classes.push(
        "slideshow--animated slideshow--" + this.state.animationDirection
      );
    } else {
      classes = ["slideshow"];
    }
    return (
      <div className={classes.join(" ")}>
        <Slide
          title={this.state.slides[this.state.currentSlide].title}
          image={this.state.slides[this.state.currentSlide].imageUrl}
          description={this.state.slides[this.state.currentSlide].description}
          details={this.state.slides[this.state.currentSlide].details}
          count={this.state.currentSlide + 1}
          changeSlide={this.changeSlide}
          slideLength={this.state.slides.length}
        />
      </div>
    );
  }
}

class Slide extends React.Component {
  constructor() {
    super();

    this.state = {};
  }
  render() {
    return (
      <div className="slide">
        <div className="slide__decorative-sidebar">
          <img src={this.props.image} />
        </div>

        <div className="slide__info">
          <div className="slide__info__text">
            <h1 className="slide__info__title">{this.props.title}</h1>
            <p className="slide__info__description">{this.props.description}</p>
          </div>
          <img
            src={this.props.image}
            alt={this.props.title}
            className="slide__info__image"
          />
          <div className="slide__arrows">
            <a
              className={
                this.props.count > 1
                  ? `slide__arrows__arrow`
                  : `slide__arrows__arrow slide__arrows__arrow--disabled`
              }
              onClick={e => this.props.changeSlide("left")}
            >
              {`<`}
              {/* shrug */}
            </a>
            <a
              className={
                this.props.count < this.props.slideLength
                  ? `slide__arrows__arrow`
                  : `slide__arrows__arrow slide__arrows__arrow--disabled`
              }
              onClick={e => this.props.changeSlide("right")}
            >
              >
            </a>
          </div>
        </div>

        <div className="slide__next">
          <span>Next: Factors</span>
        </div>

        <div className="slide__details">
          <div className="slide__details__title">Discover the details</div>

          <div className="slide__details__block slide__details__block--temp">
            <h3 className="slide__details__subtitle">Temperature</h3>
            <p className="slide__details__block__description">
              {this.props.details.temperature}
            </p>
          </div>

          <div className="slide__details__block slide__details__block--water">
            <h3 className="slide__details__subtitle">Water</h3>
            <p className="slide__details__block__description">
              {this.props.details.water}
            </p>
          </div>

          <div className="slide__details__block slide__details__block--nutrition">
            <h3 className="slide__details__subtitle">Nutrition</h3>
            <p className="slide__details__block__description">
              {this.props.details.nutrition}
            </p>
          </div>
        </div>

        <div className="slide__count">
          <p className="slide__count__title">Explore</p>
          <span className="slide__count__count">
            0<span>{this.props.count}</span>
          </span>
        </div>
      </div>
    );
  }
}

// RENDER

ReactDOM.render(<Slideshow />, document.getElementById("root"));

              
            
!
999px

Console