Skip to content

Instantly share code, notes, and snippets.

@jameswquinn
Created June 8, 2020 17:40
Show Gist options
  • Select an option

  • Save jameswquinn/a09a0fe742ac79ba0aba907d8a6369da to your computer and use it in GitHub Desktop.

Select an option

Save jameswquinn/a09a0fe742ac79ba0aba907d8a6369da to your computer and use it in GitHub Desktop.
Siema - React basic example
<div id="root"></div>
class App extends React.Component {
prev = () => {
this.siema.prev()
};
next = () => {
this.siema.next()
};
render() {
return (
<div>
<div className="siema">
<div><img src="https://pawelgrzybek.com/siema/assets/siema--pink.svg" alt="Siema image" /></div>
<div><img src="https://pawelgrzybek.com/siema/assets/siema--yellow.svg" alt="Siema image" /></div>
<div><img src="https://pawelgrzybek.com/siema/assets/siema--pink.svg" alt="Siema image" /></div>
<div><img src="https://pawelgrzybek.com/siema/assets/siema--yellow.svg" alt="Siema image" /></div>
</div>
<button onClick={this.prev}>Prev</button>
<button onClick={this.next}>Next</button>
</div>
);
}
componentDidMount() {
this.siema = new Siema();
}
}
ReactDOM.render(<App/>, document.getElementById('root'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.min.js"></script>
<script src="https://pawelgrzybek.com/siema/assets/siema.min.js"></script>
body {
width: 100%;
max-width: 30rem;
margin: 0 auto;
}
img {
width: 100%;
}
.siema {
margin: 1rem 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment