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

              
                #root
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');
  
:root {
  --container-padding: 35px;
}

* {
  box-sizing: border-box;
}

html,
body {
  background-color: #F8F8F8;
  overscroll-behavior-y: contain;
  overflow: hidden;
  margin: 0;
  padding: 0;
  user-select: none;
  font-family:  "Noto Sans", avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto,
    segoe ui, arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  font-style: normal;
}

button {
  border: 0;
  border-radius: 0;
  background:transparent;
  color: inherit;
  font-size: 1em;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  font-family: avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto,
  segoe ui, arial, sans-serif;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

.prose {
  font-family: "Noto Serif", serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "wdth" 100;
}

.app-layout {
  background-color: #fff;
  box-shadow: 0 0 60px rgba(0, 0, 0, .2);
  width: 100%;
  height: calc(100% - 60px);
  max-width: 500px;
  margin-top: auto;
  position: absolute;
  overflow: hidden;
  margin: auto;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--container-padding) / 1.5);
  border-radius: 30px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 800px;

  &__system-bar {
    position: relative;
    z-index: 100500;

    img {
      width: 100%;
    }
  }
}

.container {
  padding: 0 var(--container-padding);
}

.slider {
  height: 100%;
}

.slider__container {
  position: relative;
  height: 100%;
}

.slider__item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: right center;
  will-change: transform, opacity;
}

.slider__inner {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  width: 100%;
  height: 100%;
  will-change: box-shadow;
  border-radius: 20px;
  overflow: hidden;
  transform: translate3d(0, 0, 0);

  > video {
    object-fit: cover;
    width: 100%;
    height: 100%;
  }
}

.screen-modal__scroll {
  height: 100%;
  will-change: transform, opacity;
  
  > div {
    height: 100%;
    overflow: auto;
  }
}

.screen-modal-root {
  --container-padding2: calc(var(--container-padding) / 1.5);
  --container-padding3: calc(var(--container-padding) / 2);
  --margin: calc(var(--container-padding) / 6);

  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;

  > .container {
    will-change: transform, opacity;
  }

  .container {
    padding: 0 var(--container-padding2);
  }
}

.screen-modal {
  background-color: white;
  position: absolute;
  height: 50%;
  width: 100%;
  left: 0;
  bottom: 0;
  will-change: transform;

  .container {
    padding: var(--container-padding3) var(--container-padding2);
  }

  .screen-modal__content {
    padding-top: calc(var(--container-padding) / 1.5);
    border-bottom: 1px solid #ededed;
  
    .header__title {
      margin-bottom: var(--margin);
      padding-right: 0;
    }
  
    .header__address {
      margin-bottom: var(--margin);
    }
  }

  p {
    margin-top: 0;
  }
}

.header {
  position: relative;
  height: 60px;
  margin: 20px 0;
  will-change: transform, opacity;

  > div {
    position: absolute;
    will-change: transform, opacity;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
  }
}

.header__item {
  width: 100%;
}

.header__title {
  font-size: 28px;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.5;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 20px;
}

.header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 0;
}

.header__address {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  font-style: normal;

  .fas {
    margin-right: 10px;
  }
}

.header__date {
  font-size: 15px;
  font-weight: 600;
}

.footer {
  display: flex;
  justify-content: space-between;
  padding-bottom: 20px;
}

.button {
  padding: calc(var(--container-padding) / 3);
}

.events-screen {
  height: 100%;
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.events-screen__slider {
  position: relative;
  // height: calc(80% - 75px);
  margin-bottom: 25px;
  // height: 62%;
  width: 78%;
  flex: 1;

  .slider {
    padding-left: var(--container-padding);
  }
}

.burger-button {
  font-size: 25px;
}

.event-button {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  line-height: 1;

  .fas {
    font-size: 12px;
    margin-right: 5px;
  }
}

.nav-bar {}

.nav-bar__back {
  padding-left: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: baseline;

  .fas {
    margin-right: 14px;
  }
}

.credits {
	font-size: .8em;
	margin-bottom: 1em;
	text-align: center;
  

  a {
	  font-weight: 600;
	  color: #91a7ff;
	  text-decoration: none;
	
    &:hover {
		  color: #5c7cfa;
		  text-decoration: underline;
    }
  }
}

.love {
	background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/42764/heart-smil.svg);
	display: inline-block;
	height: 16px;
	vertical-align: middle;
	width: 16px;
}
              
            
!

JS

              
                const { useSprings, interpolate, useTransition, animated, useSpring } = ReactSpring;
const { useGesture } = ReactUseGesture;
const cx = classNames;

const pages = [
  {
    id: 1,
    title: 'Magic of Photo',
    date: 'Nov 20th 2020',
    place: 'Kyiv, Ukraine',
    video:
      'https://player.vimeo.com/external/387172534.sd.mp4?s=fb4985189e9acf6520ba02ffd085812cf0dade97&profile_id=165&oauth2_token_id=57447761',
    poster:
      'https://images.pexels.com/videos/3627139/free-video-3627139.jpg?auto=compress&cs=tinysrgb&dpr=1&w=500',
    text: `<p>Natoque sodales nibh morbi pharetra massa felis porta tincidunt blandit facilisis gravida condimentum. Lectus orci nulla pharetra volutpat. Tristique scelerisque mus elementum? Mauris augue varius gravida torquent! Conubia malesuada malesuada fringilla fermentum est mus purus imperdiet ipsum venenatis per neque. Arcu commodo a aliquam etiam iaculis velit commodo nisi sit. Quisque augue netus sociis.</p><p>Nostra semper aliquam ante malesuada erat netus vehicula. Volutpat molestie pellentesque consequat. Primis neque interdum hac eu natoque praesent congue metus tempor cum augue. Volutpat torquent, fermentum mattis. Ac sed fringilla consequat mauris libero elementum vel quisque condimentum. Taciti placerat, nisl bibendum parturient! Vehicula porta rhoncus class. Mattis magnis viverra nisl nullam tortor tortor duis justo sociis auctor. Dis semper duis aliquam amet quis sociosqu mauris dis. Nullam egestas elit tincidunt montes, purus.</p><p>Montes inceptos molestie accumsan? Primis scelerisque sociis dapibus et sollicitudin interdum at imperdiet primis accumsan. Diam adipiscing nec magnis dapibus sed lobortis. Gravida nunc, mollis nunc hendrerit. Nullam nisi cursus phasellus per ridiculus sagittis orci habitasse, torquent lacinia facilisi! Dis metus nibh consectetur ante elementum conubia sociosqu praesent scelerisque curabitur. Vel dapibus tellus tortor nunc adipiscing blandit vel morbi nisl, ultrices?</p><p>Rutrum sociis semper nascetur cursus, donec sociis condimentum senectus magna pulvinar sed. Potenti cursus habitasse dapibus. Quis dapibus libero fusce convallis. Venenatis euismod torquent rhoncus enim a lectus fringilla nostra semper. Rutrum, eu curabitur aliquet massa dis nec lobortis placerat rhoncus. Nullam eget tempor inceptos sit viverra ultrices dictum lacus eros felis! Proin odio tellus nibh velit at convallis pulvinar turpis habitasse. Faucibus vel id dignissim suscipit habitant turpis lacus nascetur mus. Justo nulla porttitor dis lorem mi luctus conubia porta fusce. Ridiculus, litora.</p><p>Est habitasse hendrerit et in. Suscipit nascetur, pellentesque sem. Nascetur a egestas litora fames eget aliquet mollis orci fringilla convallis? Mus risus maecenas ridiculus purus justo libero interdum maecenas sagittis semper habitant. Montes per duis himenaeos. Adipiscing condimentum purus rutrum habitant mi nisl ridiculus nec congue. Lacinia mattis dignissim congue tristique eu vel eleifend urna congue euismod! Volutpat tempor habitasse integer phasellus scelerisque. Cras habitasse potenti cum.</p>`,
  },
  {
    id: 2,
    title: 'Rock Fest',
    date: 'Jan 24th 2017',
    place: 'Kharkiv, Ukraine',
    image:
      'https://images.pexels.com/photos/164693/pexels-photo-164693.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
    text: `<p>Natoque sodales nibh morbi pharetra massa felis porta tincidunt blandit facilisis gravida condimentum. Lectus orci nulla pharetra volutpat. Tristique scelerisque mus elementum? Mauris augue varius gravida torquent! Conubia malesuada malesuada fringilla fermentum est mus purus imperdiet ipsum venenatis per neque. Arcu commodo a aliquam etiam iaculis velit commodo nisi sit. Quisque augue netus sociis.</p><p>Nostra semper aliquam ante malesuada erat netus vehicula. Volutpat molestie pellentesque consequat. Primis neque interdum hac eu natoque praesent congue metus tempor cum augue. Volutpat torquent, fermentum mattis. Ac sed fringilla consequat mauris libero elementum vel quisque condimentum. Taciti placerat, nisl bibendum parturient! Vehicula porta rhoncus class. Mattis magnis viverra nisl nullam tortor tortor duis justo sociis auctor. Dis semper duis aliquam amet quis sociosqu mauris dis. Nullam egestas elit tincidunt montes, purus.</p><p>Montes inceptos molestie accumsan? Primis scelerisque sociis dapibus et sollicitudin interdum at imperdiet primis accumsan. Diam adipiscing nec magnis dapibus sed lobortis. Gravida nunc, mollis nunc hendrerit. Nullam nisi cursus phasellus per ridiculus sagittis orci habitasse, torquent lacinia facilisi! Dis metus nibh consectetur ante elementum conubia sociosqu praesent scelerisque curabitur. Vel dapibus tellus tortor nunc adipiscing blandit vel morbi nisl, ultrices?</p><p>Rutrum sociis semper nascetur cursus, donec sociis condimentum senectus magna pulvinar sed. Potenti cursus habitasse dapibus. Quis dapibus libero fusce convallis. Venenatis euismod torquent rhoncus enim a lectus fringilla nostra semper. Rutrum, eu curabitur aliquet massa dis nec lobortis placerat rhoncus. Nullam eget tempor inceptos sit viverra ultrices dictum lacus eros felis! Proin odio tellus nibh velit at convallis pulvinar turpis habitasse. Faucibus vel id dignissim suscipit habitant turpis lacus nascetur mus. Justo nulla porttitor dis lorem mi luctus conubia porta fusce. Ridiculus, litora.</p><p>Est habitasse hendrerit et in. Suscipit nascetur, pellentesque sem. Nascetur a egestas litora fames eget aliquet mollis orci fringilla convallis? Mus risus maecenas ridiculus purus justo libero interdum maecenas sagittis semper habitant. Montes per duis himenaeos. Adipiscing condimentum purus rutrum habitant mi nisl ridiculus nec congue. Lacinia mattis dignissim congue tristique eu vel eleifend urna congue euismod! Volutpat tempor habitasse integer phasellus scelerisque. Cras habitasse potenti cum.</p>`,
  },
  {
    id: 3,
    title: 'Summer Party',
    date: 'July 7th 2017',
    place: 'Lviv, Ukraine',
    image:
      'https://images.pexels.com/photos/1164985/pexels-photo-1164985.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
    text: `<p>Natoque sodales nibh morbi pharetra massa felis porta tincidunt blandit facilisis gravida condimentum. Lectus orci nulla pharetra volutpat. Tristique scelerisque mus elementum? Mauris augue varius gravida torquent! Conubia malesuada malesuada fringilla fermentum est mus purus imperdiet ipsum venenatis per neque. Arcu commodo a aliquam etiam iaculis velit commodo nisi sit. Quisque augue netus sociis.</p><p>Nostra semper aliquam ante malesuada erat netus vehicula. Volutpat molestie pellentesque consequat. Primis neque interdum hac eu natoque praesent congue metus tempor cum augue. Volutpat torquent, fermentum mattis. Ac sed fringilla consequat mauris libero elementum vel quisque condimentum. Taciti placerat, nisl bibendum parturient! Vehicula porta rhoncus class. Mattis magnis viverra nisl nullam tortor tortor duis justo sociis auctor. Dis semper duis aliquam amet quis sociosqu mauris dis. Nullam egestas elit tincidunt montes, purus.</p><p>Montes inceptos molestie accumsan? Primis scelerisque sociis dapibus et sollicitudin interdum at imperdiet primis accumsan. Diam adipiscing nec magnis dapibus sed lobortis. Gravida nunc, mollis nunc hendrerit. Nullam nisi cursus phasellus per ridiculus sagittis orci habitasse, torquent lacinia facilisi! Dis metus nibh consectetur ante elementum conubia sociosqu praesent scelerisque curabitur. Vel dapibus tellus tortor nunc adipiscing blandit vel morbi nisl, ultrices?</p><p>Rutrum sociis semper nascetur cursus, donec sociis condimentum senectus magna pulvinar sed. Potenti cursus habitasse dapibus. Quis dapibus libero fusce convallis. Venenatis euismod torquent rhoncus enim a lectus fringilla nostra semper. Rutrum, eu curabitur aliquet massa dis nec lobortis placerat rhoncus. Nullam eget tempor inceptos sit viverra ultrices dictum lacus eros felis! Proin odio tellus nibh velit at convallis pulvinar turpis habitasse. Faucibus vel id dignissim suscipit habitant turpis lacus nascetur mus. Justo nulla porttitor dis lorem mi luctus conubia porta fusce. Ridiculus, litora.</p><p>Est habitasse hendrerit et in. Suscipit nascetur, pellentesque sem. Nascetur a egestas litora fames eget aliquet mollis orci fringilla convallis? Mus risus maecenas ridiculus purus justo libero interdum maecenas sagittis semper habitant. Montes per duis himenaeos. Adipiscing condimentum purus rutrum habitant mi nisl ridiculus nec congue. Lacinia mattis dignissim congue tristique eu vel eleifend urna congue euismod! Volutpat tempor habitasse integer phasellus scelerisque. Cras habitasse potenti cum.</p>`,
  },
  {
    id: 4,
    title: 'Magic of Photo',
    date: 'Nov 20th 2020',
    place: 'Kyiv, Ukraine',
    image:
      'https://images.pexels.com/photos/1540977/pexels-photo-1540977.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
    text: `<p>Natoque sodales nibh morbi pharetra massa felis porta tincidunt blandit facilisis gravida condimentum. Lectus orci nulla pharetra volutpat. Tristique scelerisque mus elementum? Mauris augue varius gravida torquent! Conubia malesuada malesuada fringilla fermentum est mus purus imperdiet ipsum venenatis per neque. Arcu commodo a aliquam etiam iaculis velit commodo nisi sit. Quisque augue netus sociis.</p><p>Nostra semper aliquam ante malesuada erat netus vehicula. Volutpat molestie pellentesque consequat. Primis neque interdum hac eu natoque praesent congue metus tempor cum augue. Volutpat torquent, fermentum mattis. Ac sed fringilla consequat mauris libero elementum vel quisque condimentum. Taciti placerat, nisl bibendum parturient! Vehicula porta rhoncus class. Mattis magnis viverra nisl nullam tortor tortor duis justo sociis auctor. Dis semper duis aliquam amet quis sociosqu mauris dis. Nullam egestas elit tincidunt montes, purus.</p><p>Montes inceptos molestie accumsan? Primis scelerisque sociis dapibus et sollicitudin interdum at imperdiet primis accumsan. Diam adipiscing nec magnis dapibus sed lobortis. Gravida nunc, mollis nunc hendrerit. Nullam nisi cursus phasellus per ridiculus sagittis orci habitasse, torquent lacinia facilisi! Dis metus nibh consectetur ante elementum conubia sociosqu praesent scelerisque curabitur. Vel dapibus tellus tortor nunc adipiscing blandit vel morbi nisl, ultrices?</p><p>Rutrum sociis semper nascetur cursus, donec sociis condimentum senectus magna pulvinar sed. Potenti cursus habitasse dapibus. Quis dapibus libero fusce convallis. Venenatis euismod torquent rhoncus enim a lectus fringilla nostra semper. Rutrum, eu curabitur aliquet massa dis nec lobortis placerat rhoncus. Nullam eget tempor inceptos sit viverra ultrices dictum lacus eros felis! Proin odio tellus nibh velit at convallis pulvinar turpis habitasse. Faucibus vel id dignissim suscipit habitant turpis lacus nascetur mus. Justo nulla porttitor dis lorem mi luctus conubia porta fusce. Ridiculus, litora.</p><p>Est habitasse hendrerit et in. Suscipit nascetur, pellentesque sem. Nascetur a egestas litora fames eget aliquet mollis orci fringilla convallis? Mus risus maecenas ridiculus purus justo libero interdum maecenas sagittis semper habitant. Montes per duis himenaeos. Adipiscing condimentum purus rutrum habitant mi nisl ridiculus nec congue. Lacinia mattis dignissim congue tristique eu vel eleifend urna congue euismod! Volutpat tempor habitasse integer phasellus scelerisque. Cras habitasse potenti cum.</p>`,
  },
  {
    id: 5,
    title: 'Rock Fest',
    date: 'Jan 24th 2017',
    place: 'Kharkiv, Ukraine',
    image:
      'https://images.pexels.com/photos/2311713/pexels-photo-2311713.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
    text: `<p>Natoque sodales nibh morbi pharetra massa felis porta tincidunt blandit facilisis gravida condimentum. Lectus orci nulla pharetra volutpat. Tristique scelerisque mus elementum? Mauris augue varius gravida torquent! Conubia malesuada malesuada fringilla fermentum est mus purus imperdiet ipsum venenatis per neque. Arcu commodo a aliquam etiam iaculis velit commodo nisi sit. Quisque augue netus sociis.</p><p>Nostra semper aliquam ante malesuada erat netus vehicula. Volutpat molestie pellentesque consequat. Primis neque interdum hac eu natoque praesent congue metus tempor cum augue. Volutpat torquent, fermentum mattis. Ac sed fringilla consequat mauris libero elementum vel quisque condimentum. Taciti placerat, nisl bibendum parturient! Vehicula porta rhoncus class. Mattis magnis viverra nisl nullam tortor tortor duis justo sociis auctor. Dis semper duis aliquam amet quis sociosqu mauris dis. Nullam egestas elit tincidunt montes, purus.</p><p>Montes inceptos molestie accumsan? Primis scelerisque sociis dapibus et sollicitudin interdum at imperdiet primis accumsan. Diam adipiscing nec magnis dapibus sed lobortis. Gravida nunc, mollis nunc hendrerit. Nullam nisi cursus phasellus per ridiculus sagittis orci habitasse, torquent lacinia facilisi! Dis metus nibh consectetur ante elementum conubia sociosqu praesent scelerisque curabitur. Vel dapibus tellus tortor nunc adipiscing blandit vel morbi nisl, ultrices?</p><p>Rutrum sociis semper nascetur cursus, donec sociis condimentum senectus magna pulvinar sed. Potenti cursus habitasse dapibus. Quis dapibus libero fusce convallis. Venenatis euismod torquent rhoncus enim a lectus fringilla nostra semper. Rutrum, eu curabitur aliquet massa dis nec lobortis placerat rhoncus. Nullam eget tempor inceptos sit viverra ultrices dictum lacus eros felis! Proin odio tellus nibh velit at convallis pulvinar turpis habitasse. Faucibus vel id dignissim suscipit habitant turpis lacus nascetur mus. Justo nulla porttitor dis lorem mi luctus conubia porta fusce. Ridiculus, litora.</p><p>Est habitasse hendrerit et in. Suscipit nascetur, pellentesque sem. Nascetur a egestas litora fames eget aliquet mollis orci fringilla convallis? Mus risus maecenas ridiculus purus justo libero interdum maecenas sagittis semper habitant. Montes per duis himenaeos. Adipiscing condimentum purus rutrum habitant mi nisl ridiculus nec congue. Lacinia mattis dignissim congue tristique eu vel eleifend urna congue euismod! Volutpat tempor habitasse integer phasellus scelerisque. Cras habitasse potenti cum.</p>`,
  },
  {
    id: 6,
    title: 'Summer Party',
    date: 'July 7th 2017',
    place: 'Lviv, Ukraine',
    image:
      'https://images.pexels.com/photos/1694348/pexels-photo-1694348.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
    text: `<p>Natoque sodales nibh morbi pharetra massa felis porta tincidunt blandit facilisis gravida condimentum. Lectus orci nulla pharetra volutpat. Tristique scelerisque mus elementum? Mauris augue varius gravida torquent! Conubia malesuada malesuada fringilla fermentum est mus purus imperdiet ipsum venenatis per neque. Arcu commodo a aliquam etiam iaculis velit commodo nisi sit. Quisque augue netus sociis.</p><p>Nostra semper aliquam ante malesuada erat netus vehicula. Volutpat molestie pellentesque consequat. Primis neque interdum hac eu natoque praesent congue metus tempor cum augue. Volutpat torquent, fermentum mattis. Ac sed fringilla consequat mauris libero elementum vel quisque condimentum. Taciti placerat, nisl bibendum parturient! Vehicula porta rhoncus class. Mattis magnis viverra nisl nullam tortor tortor duis justo sociis auctor. Dis semper duis aliquam amet quis sociosqu mauris dis. Nullam egestas elit tincidunt montes, purus.</p><p>Montes inceptos molestie accumsan? Primis scelerisque sociis dapibus et sollicitudin interdum at imperdiet primis accumsan. Diam adipiscing nec magnis dapibus sed lobortis. Gravida nunc, mollis nunc hendrerit. Nullam nisi cursus phasellus per ridiculus sagittis orci habitasse, torquent lacinia facilisi! Dis metus nibh consectetur ante elementum conubia sociosqu praesent scelerisque curabitur. Vel dapibus tellus tortor nunc adipiscing blandit vel morbi nisl, ultrices?</p><p>Rutrum sociis semper nascetur cursus, donec sociis condimentum senectus magna pulvinar sed. Potenti cursus habitasse dapibus. Quis dapibus libero fusce convallis. Venenatis euismod torquent rhoncus enim a lectus fringilla nostra semper. Rutrum, eu curabitur aliquet massa dis nec lobortis placerat rhoncus. Nullam eget tempor inceptos sit viverra ultrices dictum lacus eros felis! Proin odio tellus nibh velit at convallis pulvinar turpis habitasse. Faucibus vel id dignissim suscipit habitant turpis lacus nascetur mus. Justo nulla porttitor dis lorem mi luctus conubia porta fusce. Ridiculus, litora.</p><p>Est habitasse hendrerit et in. Suscipit nascetur, pellentesque sem. Nascetur a egestas litora fames eget aliquet mollis orci fringilla convallis? Mus risus maecenas ridiculus purus justo libero interdum maecenas sagittis semper habitant. Montes per duis himenaeos. Adipiscing condimentum purus rutrum habitant mi nisl ridiculus nec congue. Lacinia mattis dignissim congue tristique eu vel eleifend urna congue euismod! Volutpat tempor habitasse integer phasellus scelerisque. Cras habitasse potenti cum.</p>`,
  },
];

const Button = ({
  children,
  className,
  ...rest
}) => {
  const classNames = cx('button', className);

  return (
    <button className={classNames} {...rest}>
      {children}
    </button>
  );
};

const Container = React.forwardRef(({
  className,
  as: Component,
  children,
  ...props
}, ref) => {
  const classNames = cx('container', className);

  return (
    <Component className={classNames} ref={ref} {...props}>
      {children}
    </Component>
  );
});

Container.defaultProps = {
  as: 'div',
};

const Address = ({
  data,
}) => (
  <div>
    <address className='header__address'>
      <i className='fas fa-map-marker-alt' />
      {data.place}
    </address>
  </div>
);

const HeaderTitle = ({
  data,
}) => (
  <h1 className='header__title'>{data.title}</h1>
);

const HeaderDate = ({
  data,
}) => (
  <time className='header__date'>{data.date}</time>
);

const HeaderTop = ({
  data,
}) => (
  <div className='header__top'>
    <HeaderTitle data={data} />
    <HeaderDate data={data} />
  </div>
);

const HeaderItem = ({
  data,
}) => {
  return (
    <Container className='header__item'>
      <HeaderTop data={data} />
      <Address data={data} />
    </Container>
  );
};

const Header = ({
  data,
  index,
  as: Component,
}) => {
  const [prev] = React.useState({ index });

  const transitions = useTransition(index, p => p, {
    from: (newIdx) => {
      const dir = newIdx - prev.index;
      prev.index = newIdx;
      return { opacity: 0, transform: `translate3d(0, ${100 * dir}%, 0)` };
    },
    enter: () => {
      return { opacity: 1, transform: `translate3d(0, 0%, 0)` };
    },
    leave: (newIdx) => {
      const dir = newIdx - index;
      return { opacity: 0, transform: `translate3d(0, ${100 * dir}%, 0)` };
    },
  })

  return (
    <div className='header'>
      {transitions.map(({ item, props, key }) => {
        return (
          <animated.div
            key={key}
            style={props}
          >
            <Component data={data[item]} />
          </animated.div>
        )
      })}
    </div>
  )
};

const Footer = () => {
  return (
    <Container className='footer'>
      <Button className='burger-button'>
        <i className='fas fa-bars' />
      </Button>
      <Button className='event-button'>
        <i className='fas fa-plus' />
        Create Event
      </Button>
    </Container>
  );
};

const MAX_COUNT = 3;

const onNext = (
  { args: [index], down },
  { isNextTrigger, getStartData, onChange, ref, drag },
  i,
) => {
  if (!isNextTrigger || down) {
    return
  }

  if (index === i) {
    return {
      ...getStartData(i),
      x: -ref.current.offsetWidth,
      sc: 1,
      opacity: 1,
      immediate: false,
      onStart: () => {
        onChange(index + 1);
      },
      onRest: () => {
        drag.cancel();
      },
    };
  }

  if (i - index > 0) {
    const currentIndex = i - index - 1;
    return {
      ...getStartData(currentIndex),
      immediate: false,
      onStart: undefined,
      onRest: undefined,
    };
  }
};

const onPrev = (
  { args: [index], down },
  { isPrevTrigger, getStartData, onChange, drag },
  i,
) => {
  if (!isPrevTrigger || down) {
    return;
  }

  if (index > 0 && i - index >= -1 && isPrevTrigger) {
    const currentIndex = i - index + 1;

    let indexConf = {
      onStart: undefined,
      onRest: undefined,
    };

    if (index === i) {
      indexConf.onStart = () => {
        onChange(index - 1);
      };

      indexConf.onRest = () => {
        drag.cancel();
      };
    }

    return {
      ...getStartData(currentIndex),
      immediate: false,
      ...indexConf,
    };
  }
};

const isNotTarget = (
  { args: [index] },
  data, i,
) => {
  if (index !== i) {
    return {
      onStart: undefined,
      onRest: undefined,
    };
  }
};

const isNotDown = (
  { down },
  { drag },
) => {
  if (down) {
    return;
  }

  return {
    x: 0,
    immediate: false,
    onRest: () => {
      drag.cancel();
    },
  };
};

const onDefault = ({
  movement,
}) => ({
  x: movement[0],
  immediate: true,
  reset: false,
  onStart: undefined,
  onRest: undefined,
});

const useIsDrag = () => {
  const [state] = React.useState({});
  const setIsDrag = (movement) => {
    const xMod = Math.abs(movement[0]);

    if (xMod > 2) {
      state.isDrag = true;
    }
  };

  const cancel = () => {
    state.isDrag = false;
  };

  return {
    state,
    setIsDrag,
    cancel,
  }
};

const useSlider = ({
  data,
  onChange,
  ref,
  onClick,
}) => {
  const totalItems = data.length;
  const drag = useIsDrag();
  const getStartData = (i) => {
    const isVisible = i <= MAX_COUNT - 1;
    const multiplier =  i === 0 ? 1 : 1.1;

    return ({
      x: isVisible ? i * 28 / multiplier : (MAX_COUNT - 1) * 28,
      y: 0,
      sc: isVisible ? 1 / (MAX_COUNT / (MAX_COUNT * multiplier - i)) : 1 / MAX_COUNT,
      opacity: isVisible ? 1 / (MAX_COUNT / (MAX_COUNT - i)) : 0,
      display: 'block',
      pointerEvents: i === 0 ? '' : 'none',
      boxShadow: i === 0 ? '0 10px 40px rgba(0, 0, 0, .2)' : '0 0px 0px rgba(0, 0, 0, .2)',
      position: '',
      transformOrigin: '',
      width: '',
      height: '',
    })
  };
  const [props, set] = useSprings(totalItems, getStartData);

  const bind = useGesture({
    onDrag: (state) => { 
      const { args: [index], down, movement, cancel } = state;
      const isNextTrigger = movement[0] <= -100 && index !== totalItems - 1;
      const isPrevTrigger = movement[0] >= 24;

      const data = {
        isNextTrigger,
        isPrevTrigger,
        getStartData,
        onChange,
        ref,
        drag,
      };

      if (down) {
        drag.setIsDrag(movement);
      }

      if ((isNextTrigger || isPrevTrigger) && down) {
        cancel(index);
      }

      set(i => {
        const action = R.find(
          fn => fn(state, data, i),
          [
            onNext,
            onPrev,
            isNotTarget,
            isNotDown,
            onDefault,
          ],
        );

        if (action) {
          return action(state, data, i);
        }
      });
    },
  });

  const map = (component) => {
    return props.map(({ x, y, display, sc, opacity, pointerEvents, boxShadow, ...rest }, i) => {
      const root = {
        key: i,
        style: {
          display,
          transform: interpolate([x, y, sc], (x, y, s) => `translate3d(${x}px, ${y}px, 0) scale(${s})`),
          opacity,
          pointerEvents,
          zIndex: data.length - i,
          ...rest,
        },
        ...bind(i),
      };

      const inner = {
        style: {
          boxShadow,
        },
      };

      const onClickHandler = (...args) => {
        if (drag.state.isDrag) {
          return;
        }

        onClick(set, i, ...args);
      };

      return (
        component({
          root,
          inner,
          ref,
          item: data[i],
          onClick: onClickHandler,
        })
      );
    });
  };

  return {
    map,
    ref,
    set,
    getStartData,
  };
};


const Slider = ({
  slider,
}) => {
  const { map, ref } = slider;

  return (
    <div className='slider' ref={ref}>
      <div className='slider__container'>
        {map(({ root, inner, onClick, item, itemRef }) => {
          const videoSrc = R.path(['video'])(item);
          const videoPoster = R.path(['poster'])(item);

          return (
            <animated.div ref={itemRef} className='slider__item' onClick={onClick} {...root}>
              <animated.div
                className='slider__inner' {...inner}
                style={{
                  backgroundImage: `url(${R.path(['image'])(item)})`,
                  ...inner,
                }}
              >
                {videoSrc && (
                  <video src={videoSrc} poster={videoPoster} autoPlay loop muted playsInline />
                )}
              </animated.div>
            </animated.div>
          );
        })}
      </div>
    </div>
  );
};


const ScreenModal = ({
  onClose,
  isOpen,
  children,
}) => {
  const mainSpring = useSpring({
    from: { x: 0 },
    x: isOpen ? 1 : 0,
    pointerEvents: isOpen ? '' : 'none',
  });

  const contentSpring = useSpring({
    from: { x: 0 },
    x: isOpen ? 1 : 0,
    pointerEvents: isOpen ? '' : 'none',
    config: { duration: 400 },
  });

  return (
    <ScreenModalRoot mainSpring={mainSpring}>
      <ScreenModalTopBar mainSpring={mainSpring}>
        <Button className='nav-bar__back' onClick={onClose}>
          <i className='fas fa-long-arrow-alt-left' />
          Events
        </Button>
      </ScreenModalTopBar>
      <ScreenModalContainer
        mainSpring={mainSpring}
        contentSpring={contentSpring}
        children={children}
      />
    </ScreenModalRoot>
  );
};

const ScreenModalRoot = ({
  mainSpring,
  children,
}) => (
  <animated.div
    className='screen-modal-root'
    style={{
      pointerEvents: mainSpring.pointerEvents,
    }}
    children={children}
  />
);

const ScreenModalTopBar = ({
  mainSpring,
  children,
}) => (
  <Container
    as={animated.div}
    style={{
      color: 'white',
      opacity: mainSpring.x.interpolate({ range: [0, 1], output: [0, 1] }),
      transform: mainSpring.x
        .interpolate({
          range: [0, 1],
          output: [100, 0]
        })
        .interpolate(x => `translate3d(0, ${x}%, 0`)
    }}
    children={children}
  />
);

const ScreenModalContainer = ({
  mainSpring,
  contentSpring,
  children,
}) => (
  <animated.div
    className='screen-modal'
    style={{
      transform: mainSpring.x
        .interpolate({
          range: [0, 1],
          output: [100, 0]
        })
        .interpolate(x => `translate3d(0, ${x}%, 0`)
    }}
  >
    <animated.div
      className='screen-modal__scroll'
      style={{
        opacity: contentSpring.x.interpolate({ range: [0, 1], output: [0, 1] }),
        transform: contentSpring.x
          .interpolate({
            range: [0, 1],
            output: [100, 0]
          })
          .interpolate(x => `translate3d(0, ${x}%, 0`)
      }}
    >
      {children}
    </animated.div>
  </animated.div>
);

const ScreenModalContent = ({
  data,
}) => (
  <div>
    <Container className='screen-modal__content'>
      <HeaderTitle data={data} />
      <Address data={data} />
      <HeaderDate data={data} />
    </Container>
    <Container className='prose' dangerouslySetInnerHTML={{ __html: data.text }} />
  </div>
);

const Screen = () => {
  const [current, setCurrent] = React.useState(0);
  const [isOpened, setIsOpened] = React.useState(false);
  const ref = React.useRef();
  const slider = useSlider({
    data: pages,
    onChange: setCurrent,
    ref,
    onClick: (set, index, event) => {
      const el = event.currentTarget
      const rect = el.getBoundingClientRect();

      const ws = window.innerWidth / el.offsetWidth;
      const hs = window.innerHeight / el.offsetHeight;

      set((i) => {
        if (index === i) {
          setIsOpened(true);

          return {
            x: (window.innerWidth / 2) - (rect.width / 2 ) - rect.x,
            y: (window.innerHeight / 2) - (rect.height / 2 ) - rect.y,
            sc: Math.max(ws, hs),
            pointerEvents: 'none',
            transformOrigin: 'center center'
          };
        }
      });
    },
  });

  const onCloseClick = () => {
    slider.set((i) => {
      if (i === current) {
        setIsOpened(false);
        return {
          ...slider.getStartData(0),
          transformOrigin: 'center center'
        };
      }
    })
  };

  const mainSpring = useSpring({
    from: { x: 0 },
    x: !isOpened ? 1 : 0,
  });

  const data = pages[current];

  return (
    <section className='events-screen'>
      <Container
        as={animated.div}
        className='nav-bar'
        style={{
          opacity: mainSpring.x.interpolate({ range: [0, 1], output: [0, 1] }),
          transform: mainSpring.x
            .interpolate({
              range: [0, 1],
              output: [-100, 0]
            })
            .interpolate(x => `translate3d(0, ${x}%, 0`),
        }}
      >
        <Button className='nav-bar__back'>
          <i className='fas fa-long-arrow-alt-left' />
          Events
        </Button>
      </Container>
      <Header data={pages} index={current} as={HeaderItem} />
      <div className='events-screen__slider'>
        <Slider slider={slider} />
      </div>
      <ScreenModal onClose={onCloseClick} isOpen={isOpened}>
        <ScreenModalContent key={data.id} data={data} />
      </ScreenModal>
      <Footer />
      <Container>
        <div className="credits">Created with <span class="love"></span> by <a href="https://twitter.com/odintsov_design" target="_blank">Ivan Odintsov</a>&nbsp;&nbsp;&middot;&nbsp;&nbsp;Inspired by <a href="https://dribbble.com/shots/3731362-Event-cards-iOS-interaction" target="_blank">Divan Raj</a></div>
      </Container>
    </section>
  );
};

const AppLayout = ({
  children,
}) => {
  return (
    <div className='app-layout'>
      {children}
    </div>
  );
};

const App = () => {
  return (
    <AppLayout>
      <Screen />
    </AppLayout>
  );
};

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

              
            
!
999px

Console