App.jsx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
import React from 'react'; import Stories from 'react-insta-stories'; import { Container, Row, Col, Button } from 'react-bootstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; const App = () => { const stories = [ { url: 'https://images.pexels.com/photos/577585/pexels-photo-577585.jpeg?auto=compress&cs=tinysrgb&w=600', header: { heading: 'John Doe', subheading: 'Posted 5 minutes ago', profileImage: 'https://images.pexels.com/photos/577585/pexels-photo-577585.jpeg?auto=compress&cs=tinysrgb&w=600', }, duration: 3000, }, { url: 'https://images.pexels.com/photos/1181298/pexels-photo-1181298.jpeg?auto=compress&cs=tinysrgb&w=600', header: { heading: 'Jane Smith', subheading: 'Posted 15 minutes ago', profileImage: 'https://images.pexels.com/photos/1181298/pexels-photo-1181298.jpeg?auto=compress&cs=tinysrgb&w=600', }, duration: 5000, }, { url: 'https://www.w3schools.com/html/movie.mp4', type: 'video', header: { heading: 'Video Story', subheading: 'Posted 2 minutes ago', profileImage: 'https://via.placeholder.com/100x100.png?text=VS', }, duration: 8000, }, ]; return ( <Container className="my-5"> <Row> <Col md={12}> <h2 className="text-center">Instagram-Like Stories</h2> <Stories stories={stories} defaultInterval={1500} width={432} height={768} storyContainerStyles={{ borderRadius: '10px', boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)' }} progressStyles={{ backgroundColor: 'rgba(0, 0, 0, 0.2)', height: '5px', }} loop={true} keyboardNavigation={true} onStoryStart={(index) => console.log(`Story ${index + 1} started`)} onStoryEnd={(index) => console.log(`Story ${index + 1} ended`)} onAllStoriesEnd={() => console.log('All stories ended')} /> </Col> </Row> <Row> <Col className="text-center"> <Button variant="primary" onClick={() => alert('Additional Action')}> Add Action </Button> </Col> </Row> </Container> ); }; export default App; |