|
| 1 | +import { Button } from 'primereact/button'; |
| 2 | +import { Card } from 'primereact/card'; |
| 3 | +import { Timeline } from 'primereact/timeline'; |
| 4 | + |
| 5 | +export default function CustomDemo() { |
| 6 | + const events = [ |
| 7 | + { status: 'Ordered', date: '15/10/2020 10:30', icon: 'pi pi-shopping-cart', color: '#9C27B0', image: 'game-controller.jpg' }, |
| 8 | + { status: 'Processing', date: '15/10/2020 14:00', icon: 'pi pi-cog', color: '#673AB7' }, |
| 9 | + { status: 'Shipped', date: '15/10/2020 16:15', icon: 'pi pi-shopping-cart', color: '#FF9800' }, |
| 10 | + { status: 'Delivered', date: '16/10/2020 10:00', icon: 'pi pi-check', color: '#607D8B' } |
| 11 | + ]; |
| 12 | + |
| 13 | + return ( |
| 14 | + <div className="card"> |
| 15 | + <Timeline align="alternate"> |
| 16 | + {events.map((event, index) => ( |
| 17 | + <Timeline.Event key={index} className={index % 2 === 1 ? 'max-[960px]:flex-row' : undefined}> |
| 18 | + <Timeline.Opposite /> |
| 19 | + <Timeline.Separator> |
| 20 | + <span className={['flex w-8 h-8 items-center justify-center rounded-full z-10 shadow-sm', index !== events.length - 1 ? 'text-white bg-primary' : ''].join(' ')}> |
| 21 | + <i className={event.icon}></i> |
| 22 | + </span> |
| 23 | + {index !== events.length - 1 && <Timeline.Connector />} |
| 24 | + </Timeline.Separator> |
| 25 | + <Timeline.Content className={index % 2 === 1 ? 'max-[960px]:!text-left' : undefined}> |
| 26 | + <Card className="mt-4"> |
| 27 | + <Card.Body> |
| 28 | + <Card.Caption> |
| 29 | + <Card.Title>{event.status}</Card.Title> |
| 30 | + <Card.Subtitle>{event.date}</Card.Subtitle> |
| 31 | + </Card.Caption> |
| 32 | + <Card.Content> |
| 33 | + {event.image && <img src={`https://primefaces.org/cdn/primevue/images/product/${event.image}`} alt={event.status} width="200" className="shadow-sm" />} |
| 34 | + <p> |
| 35 | + Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis |
| 36 | + esse, cupiditate neque quas! |
| 37 | + </p> |
| 38 | + <Button variant="text">Read more</Button> |
| 39 | + </Card.Content> |
| 40 | + </Card.Body> |
| 41 | + </Card> |
| 42 | + </Timeline.Content> |
| 43 | + </Timeline.Event> |
| 44 | + ))} |
| 45 | + </Timeline> |
| 46 | + </div> |
| 47 | + ); |
| 48 | +} |
0 commit comments