All Projects → gugadev → storify

gugadev / storify

Licence: MIT License
Instagram/Whatsapp stories clone built on Web Components and Web Animations API. 🔥

Programming Languages

typescript
32286 projects
CSS
56736 projects

Projects that are alternatives of or similar to storify

g-emoji-element
Backports native emoji characters to browsers that don't support them by replacing the characters with fallback images.
Stars: ✭ 112 (+75%)
Mutual labels:  web-components, custom-elements
vue-custom-element
Vue Custom Element - Web Components' Custom Elements for Vue.js
Stars: ✭ 1,886 (+2846.88%)
Mutual labels:  web-components, custom-elements
inclusive-elements
Accessible, lightweight, unstyled implementations of common UI controls.
Stars: ✭ 17 (-73.44%)
Mutual labels:  web-components, custom-elements
focus-trap
A lightweight web component that traps focus within a DOM node
Stars: ✭ 44 (-31.25%)
Mutual labels:  web-components, custom-elements
custom-elements-manifest
Custom Elements Manifest is a file format that describes custom elements in your project.
Stars: ✭ 81 (+26.56%)
Mutual labels:  web-components, custom-elements
11ty-web-component-generator
Use the power of 11ty to generate web components (custom elements).
Stars: ✭ 51 (-20.31%)
Mutual labels:  web-components, custom-elements
typing-effect-element
A custom element that shows text as if it were being typed
Stars: ✭ 81 (+26.56%)
Mutual labels:  web-components, custom-elements
range-slider-element
🍬 <range-slider> custom element
Stars: ✭ 45 (-29.69%)
Mutual labels:  web-components, custom-elements
cwco
Powerful and Fast Web Component Library with a Simple API
Stars: ✭ 27 (-57.81%)
Mutual labels:  web-components, custom-elements
ascii-image
Web Component that displays an image as ASCII art
Stars: ✭ 15 (-76.56%)
Mutual labels:  web-components, custom-elements
lego
🚀 Web-components made lightweight & Future-Proof.
Stars: ✭ 69 (+7.81%)
Mutual labels:  web-components, custom-elements
bui
‹b› Web components for creating applications – built by Blackstone Publishing using lit-html and lit-element
Stars: ✭ 29 (-54.69%)
Mutual labels:  web-components, custom-elements
element
Fast and simple custom elements.
Stars: ✭ 65 (+1.56%)
Mutual labels:  web-components, custom-elements
lit-components
Moved to https://github.com/vaadin/component-mixins
Stars: ✭ 59 (-7.81%)
Mutual labels:  web-components, custom-elements
file-attachment-element
Attach files via drag and drop or file input.
Stars: ✭ 97 (+51.56%)
Mutual labels:  web-components, custom-elements
toggle-icon
toggle-icon is a custom element created with Polymer. It provides an extremely powerful and customizable switch that looks like a paper-icon-button.
Stars: ✭ 21 (-67.19%)
Mutual labels:  web-components, custom-elements
symbiote.js
Simple, light and very powerful library to create embedded components for any purpose, with a data flow management included.
Stars: ✭ 40 (-37.5%)
Mutual labels:  web-components, custom-elements
modulor-html
Missing template engine for Web Components
Stars: ✭ 36 (-43.75%)
Mutual labels:  web-components, custom-elements
custom-element-boilerplate
Boilerplate for creating a custom element.
Stars: ✭ 137 (+114.06%)
Mutual labels:  web-components, custom-elements
smoothr
A custom React router that leverages the Web Animations API and CSS animations.
Stars: ✭ 28 (-56.25%)
Mutual labels:  web-animations-api, web-animations

wc 🌐 stories

Instagram/Whatsapp stories like built on Web Components and Web Animations API.


Demos


Vanilla JS

Angular

React

Vue
Link Link Link Link

Browser support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Opera
Opera
IE11, Edge last 10 versions last 10 versions last 10 versions last 10 versions

📦 Install

npm i @gugadev/wc-stories

💡 What's the prupose of it?

Just fun 🙂. I love learn and code, so, this every time I have free time, pick some crazy idea or got inspiration from another projects and make it. 😋

🦄 Inspiration

When I saw the project of Mohit, react-insta-stories, immediately wanted to know how complicated it would be to do the same thing using Web Components. So, I built this. Thanks, Mohit! 😃

⚙️ How it works?

There are three components working together:

  • <wc-stories-story>: this component shows a image. The maximun size of an image is the containers viewport.
  • <wc-stories-progress>: this component shows the progress bar at top the the container. It uses Web Animations API to run it. If we change of image (clicking on left/right), the previous animation is cancelled.
  • <wc-stories>: this is the main component. This one harbor the two components above. Here is the logic for control which image should be revealed, what happen if the user clicks on left or right side, etc.

🚀 How to run?

After install depenencies, you just need to run yarn start. Once the server was started, go to localhost:4444 and see it in action.

🛠️ How to build?

Execute the yarn build command to compile the source code and get the ES5 equivalent. Compiled code will be available on dist/ folder.

🙋 How to use it in my web/app?

First, we need to add the needed polyfills:

  • @webcomponents/webcomponentsjs/custom-elements-es5-adapter.js
  • @webcomponents/webcomponentsjs/webcomponents-loader.js.
  • web-animations-js/web-animations.min.js

Web Components/Vanilla JavaScript

If you're using Web Components or vanilla JavaScript, just put the wc-stories tag inside your HTML and pass it the array of images:

<wc-stories height="480" width="320" withShadow>
  <wc-stories-story src="/img/01.jpg"></wc-stories-story>
  <wc-stories-story src="/img/02.jpg"></wc-stories-story>
  <wc-stories-story src="/img/03.jpg"></wc-stories-story>
  <wc-stories-story src="/img/04.jpg"></wc-stories-story>
  <wc-stories-story src="/img/05.jpg"></wc-stories-story>
</wc-stories>

React

If you're using React, use the component as is. Instead of passing raw values you can use state to store the component configuration:

export class MyComponent extends React.Component {
  this.state = {
    width: 320,
    height: 480,
    withShadow: true,
    stories: [
      '/path/to/image',
      '/path/to/image',
      '/path/to/image',
      ...
    ]
  }
  render() {
    return (
      <wc-stories
        width={this.state.height}
        height={this.state.width}
        withShadow={this.state.withShadow}
      >
      {
        this.state.stories.map(story => (
          <wc-stories-story src={story} />
        ))
      }
      </wc-stories>
    )
  }
}

Angular

If you're using Angular, put the component inside your template. Like React, you can put the configuration inside the controller instead passing raw values:

<template>
  ...
  <wc-stories [width]="storiesWidth" [height]="storiesHeight" withShadow>
    <wc-stories-story *ngFor="let story of stories" [src]="story">
    </wc-stories-story>
  </wc-stories>
</template>
@Component({
  ...
})
class MyComponent implements OnInit {

  ngOnInit() {
    stories = [
      '/path/to/image',
      '/path/to/image',
      '/path/to/image',
      ...
    ]
  }
}

Vue

If you're using Vue, put the component inside your template. Like React, you can put the configuration inside the controller instead passing raw values:

<wc-stories :width="storiesWidth" :height="storiesHeigh" :withShadow="withShadow">
  <wc-stories-story v-if="story of stories" :src="story"></wc-stories>
</wc-stories>
export default {
  data: () => ({
    width: 320,
    height: 480,
    withShadow: tre,
    stories: [
      '/path/to/image',
      '/path/to/image',
      '/path/to/image',
      ...
    ]
  })
}

🆕 Lazy Loading

There are several ways to lazy loading images like Low quality image placeholders and progressive images. This feature relies on the first one, so, in order to enable it, you need to pass, along with the images, the placeholders too.

Tip: you can generate lightweight svg LQIP from high resolution images using sqip.

<wc-stories height="667" width="375" withShadow>
  <wc-stories-story src="img/01.jpg" placeholder="img/01.ph.svg"></wc-stories-story>
  <wc-stories-story src="img/02.jpg" placeholder="img/02.ph.svg"></wc-stories-story>
  <wc-stories-story src="img/03.jpg" placeholder="img/03.ph.svg"></wc-stories-story>
  <wc-stories-story src="img/04.jpg" placeholder="img/04.ph.svg"></wc-stories-story>
  <wc-stories-story src="img/05.jpg" placeholder="img/05.ph.svg"></wc-stories-story>
</wc-stories>

🚧 Roadmap

  • Implement Typescript
  • Implement PostCSS.
  • Make builds with Webpack.
  • Compile down to ES5.
  • Control animation's flow.
  • Orientation device support.
  • Add mobile swipe support.
  • Add more transition effects.
  • Add lazy loading support.
  • Improve suite case.
  • Add demo page.
  • Publish the package to npm.

🙌 Contribute

If you found this project interesting, I'm glade to receive updates, new features or fixes 🙂. Just fork the project, create your branch, make your changes and send your Pull Request! 😃

📖 API

<wc-stories>

  • radius <number>:: border radius. Default: 0.
  • startAt <number>: initial image index to show. Default: 0.
  • duration <number>: visibility time of images and animation.
  • height <number>: self-explanatory.
  • width <number>: self-explanatory.
  • withShadow <boolean>: enable or disable drop shadow.

<wc-stories-story>

  • src: image relative or absolute URL
  • placeholder: an image URL or a base64 string.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].