A Pen by james quinn on CodePen.
Created
June 8, 2020 17:40
-
-
Save jameswquinn/a09a0fe742ac79ba0aba907d8a6369da to your computer and use it in GitHub Desktop.
Siema - React basic example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="root"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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