|
| 1 | +import { FC } from 'react'; |
| 2 | +import { ListGroup, ListGroupItem } from '../components/ListGroup'; |
| 3 | +import { CodeExample, DemoPage } from './DemoPage'; |
| 4 | +import { HiCloudDownload, HiInbox, HiOutlineAdjustments, HiUserCircle } from 'react-icons/hi'; |
| 5 | + |
| 6 | +const ListGroupPage: FC = () => { |
| 7 | + const defaultItems: ListGroupItem[] = [ |
| 8 | + { |
| 9 | + title: 'Profile', |
| 10 | + }, |
| 11 | + { |
| 12 | + title: 'Settings', |
| 13 | + }, |
| 14 | + { |
| 15 | + title: 'Messages', |
| 16 | + }, |
| 17 | + { |
| 18 | + title: 'Download', |
| 19 | + }, |
| 20 | + ]; |
| 21 | + |
| 22 | + const itemsWithLinks: ListGroupItem[] = [ |
| 23 | + { |
| 24 | + title: 'Profile', |
| 25 | + link: '#/list-group', |
| 26 | + active: true, |
| 27 | + }, |
| 28 | + { |
| 29 | + title: 'Settings', |
| 30 | + link: '#/list-group', |
| 31 | + }, |
| 32 | + { |
| 33 | + title: 'Messages', |
| 34 | + link: '#/list-group', |
| 35 | + }, |
| 36 | + { |
| 37 | + title: 'Download', |
| 38 | + link: '#/list-group', |
| 39 | + }, |
| 40 | + ]; |
| 41 | + |
| 42 | + const itemsWithIcons: ListGroupItem[] = [ |
| 43 | + { |
| 44 | + title: 'Profile', |
| 45 | + icon: HiUserCircle, |
| 46 | + onClick: () => alert('profile'), |
| 47 | + }, |
| 48 | + { |
| 49 | + title: 'Settings', |
| 50 | + icon: HiOutlineAdjustments, |
| 51 | + }, |
| 52 | + { |
| 53 | + title: 'Messages', |
| 54 | + icon: HiInbox, |
| 55 | + }, |
| 56 | + { |
| 57 | + title: 'Download', |
| 58 | + icon: HiCloudDownload, |
| 59 | + }, |
| 60 | + ]; |
| 61 | + |
| 62 | + const examples: CodeExample[] = [ |
| 63 | + { |
| 64 | + title: 'Default list', |
| 65 | + code: <ListGroup items={defaultItems} />, |
| 66 | + }, |
| 67 | + { |
| 68 | + title: 'List group with links', |
| 69 | + code: <ListGroup items={itemsWithLinks} />, |
| 70 | + }, |
| 71 | + { |
| 72 | + title: 'List group with buttons', |
| 73 | + code: <ListGroup items={itemsWithLinks} />, |
| 74 | + }, |
| 75 | + { |
| 76 | + title: 'List group with icons', |
| 77 | + code: <ListGroup items={itemsWithIcons} />, |
| 78 | + codeStringifierOptions: { |
| 79 | + functionValue: (fn) => (fn.name === 'onClick' ? fn : fn.name), |
| 80 | + }, |
| 81 | + }, |
| 82 | + ]; |
| 83 | + |
| 84 | + return <DemoPage examples={examples} />; |
| 85 | +}; |
| 86 | + |
| 87 | +export default ListGroupPage; |
0 commit comments