|
1 |
| -import { FC } from 'react'; |
| 1 | +import { ComponentProps, FC } from 'react'; |
2 | 2 | import { HiOutlineArrowCircleDown } from 'react-icons/hi';
|
3 | 3 |
|
4 |
| -import { Accordion, AccordionItem } from '../components'; |
| 4 | +import { Accordion } from '../components'; |
5 | 5 | import { CodeExample, DemoPage } from './DemoPage';
|
6 | 6 |
|
7 | 7 | const AccordionPage: FC = () => {
|
8 |
| - const items: AccordionItem[] = [ |
9 |
| - { |
10 |
| - open: true, |
11 |
| - title: 'What is Flowbite?', |
12 |
| - body: ( |
13 |
| - <div> |
14 |
| - <p className="mb-2 text-gray-500 dark:text-gray-400"> |
15 |
| - Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, |
16 |
| - dropdowns, modals, navbars, and more. |
17 |
| - </p> |
18 |
| - <p className="text-gray-500 dark:text-gray-400"> |
19 |
| - Check out this guide to learn how to{' '} |
| 8 | + const panels = (icon?: FC<ComponentProps<'svg'>>) => [ |
| 9 | + <Accordion.Panel key={0} open> |
| 10 | + <Accordion.Title arrowIcon={icon}>What is Flowbite?</Accordion.Title> |
| 11 | + <Accordion.Content> |
| 12 | + <p className="mb-2 text-gray-500 dark:text-gray-400"> |
| 13 | + Flowbite is an open-source library of interactive components built on top of Tailwind CSS including buttons, |
| 14 | + dropdowns, modals, navbars, and more. |
| 15 | + </p> |
| 16 | + <p className="text-gray-500 dark:text-gray-400"> |
| 17 | + Check out this guide to learn how to{' '} |
| 18 | + <a |
| 19 | + href="https://flowbite.com/docs/getting-started/introduction/" |
| 20 | + className="text-blue-600 hover:underline dark:text-blue-500" |
| 21 | + > |
| 22 | + get started |
| 23 | + </a>{' '} |
| 24 | + and start developing websites even faster with components on top of Tailwind CSS. |
| 25 | + </p> |
| 26 | + </Accordion.Content> |
| 27 | + </Accordion.Panel>, |
| 28 | + <Accordion.Panel key={1}> |
| 29 | + <Accordion.Title arrowIcon={icon}>Is there a Figma file available?</Accordion.Title> |
| 30 | + <Accordion.Content> |
| 31 | + <p className="mb-2 text-gray-500 dark:text-gray-400"> |
| 32 | + Flowbite is first conceptualized and designed using the Figma software so everything you see in the library |
| 33 | + has a design equivalent in our Figma file. |
| 34 | + </p> |
| 35 | + <p className="text-gray-500 dark:text-gray-400"> |
| 36 | + Check out the{' '} |
| 37 | + <a href="https://flowbite.com/figma/" className="text-blue-600 hover:underline dark:text-blue-500"> |
| 38 | + Figma design system |
| 39 | + </a>{' '} |
| 40 | + based on the utility classes from Tailwind CSS and components from Flowbite. |
| 41 | + </p> |
| 42 | + </Accordion.Content> |
| 43 | + </Accordion.Panel>, |
| 44 | + <Accordion.Panel key={2}> |
| 45 | + <Accordion.Title arrowIcon={icon}>What are the differences between Flowbite and Tailwind UI?</Accordion.Title> |
| 46 | + <Accordion.Content> |
| 47 | + <p className="mb-2 text-gray-500 dark:text-gray-400"> |
| 48 | + The main difference is that the core components from Flowbite are open source under the MIT license, whereas |
| 49 | + Tailwind UI is a paid product. Another difference is that Flowbite relies on smaller and standalone |
| 50 | + components, whereas Tailwind UI offers sections of pages. |
| 51 | + </p> |
| 52 | + <p className="mb-2 text-gray-500 dark:text-gray-400"> |
| 53 | + However, we actually recommend using both Flowbite, Flowbite Pro, and even Tailwind UI as there is no |
| 54 | + technical reason stopping you from using the best of two worlds. |
| 55 | + </p> |
| 56 | + <p className="mb-2 text-gray-500 dark:text-gray-400">Learn more about these technologies:</p> |
| 57 | + <ul className="list-disc pl-5 text-gray-500 dark:text-gray-400"> |
| 58 | + <li> |
| 59 | + <a href="https://flowbite.com/pro/" className="text-blue-600 hover:underline dark:text-blue-500"> |
| 60 | + Flowbite Pro |
| 61 | + </a> |
| 62 | + </li> |
| 63 | + <li> |
20 | 64 | <a
|
21 |
| - href="https://flowbite.com/docs/getting-started/introduction/" |
| 65 | + href="https://tailwindui.com/" |
| 66 | + rel="nofollow" |
22 | 67 | className="text-blue-600 hover:underline dark:text-blue-500"
|
23 | 68 | >
|
24 |
| - get started |
25 |
| - </a>{' '} |
26 |
| - and start developing websites even faster with components on top of Tailwind CSS. |
27 |
| - </p> |
28 |
| - </div> |
29 |
| - ), |
30 |
| - }, |
31 |
| - { |
32 |
| - title: 'Is there a Figma file available?', |
33 |
| - body: ( |
34 |
| - <div> |
35 |
| - <p className="mb-2 text-gray-500 dark:text-gray-400"> |
36 |
| - Flowbite is first conceptualized and designed using the Figma software so everything you see in the library |
37 |
| - has a design equivalent in our Figma file. |
38 |
| - </p> |
39 |
| - <p className="text-gray-500 dark:text-gray-400"> |
40 |
| - Check out the{' '} |
41 |
| - <a href="https://flowbite.com/figma/" className="text-blue-600 hover:underline dark:text-blue-500"> |
42 |
| - Figma design system |
43 |
| - </a>{' '} |
44 |
| - based on the utility classes from Tailwind CSS and components from Flowbite. |
45 |
| - </p> |
46 |
| - </div> |
47 |
| - ), |
48 |
| - }, |
49 |
| - { |
50 |
| - title: 'What are the differences between Flowbite and Tailwind UI?', |
51 |
| - body: ( |
52 |
| - <div> |
53 |
| - <p className="mb-2 text-gray-500 dark:text-gray-400"> |
54 |
| - The main difference is that the core components from Flowbite are open source under the MIT license, whereas |
55 |
| - Tailwind UI is a paid product. Another difference is that Flowbite relies on smaller and standalone |
56 |
| - components, whereas Tailwind UI offers sections of pages. |
57 |
| - </p> |
58 |
| - <p className="mb-2 text-gray-500 dark:text-gray-400"> |
59 |
| - However, we actually recommend using both Flowbite, Flowbite Pro, and even Tailwind UI as there is no |
60 |
| - technical reason stopping you from using the best of two worlds. |
61 |
| - </p> |
62 |
| - <p className="mb-2 text-gray-500 dark:text-gray-400">Learn more about these technologies:</p> |
63 |
| - <ul className="list-disc pl-5 text-gray-500 dark:text-gray-400"> |
64 |
| - <li> |
65 |
| - <a href="https://flowbite.com/pro/" className="text-blue-600 hover:underline dark:text-blue-500"> |
66 |
| - Flowbite Pro |
67 |
| - </a> |
68 |
| - </li> |
69 |
| - <li> |
70 |
| - <a |
71 |
| - href="https://tailwindui.com/" |
72 |
| - rel="nofollow" |
73 |
| - className="text-blue-600 hover:underline dark:text-blue-500" |
74 |
| - > |
75 |
| - Tailwind UI |
76 |
| - </a> |
77 |
| - </li> |
78 |
| - </ul> |
79 |
| - </div> |
80 |
| - ), |
81 |
| - }, |
| 69 | + Tailwind UI |
| 70 | + </a> |
| 71 | + </li> |
| 72 | + </ul> |
| 73 | + </Accordion.Content> |
| 74 | + </Accordion.Panel>, |
82 | 75 | ];
|
83 | 76 |
|
84 | 77 | const examples: CodeExample[] = [
|
85 | 78 | {
|
86 | 79 | title: 'Default accordion',
|
87 |
| - code: <Accordion items={items} />, |
| 80 | + code: <Accordion>{panels()}</Accordion>, |
88 | 81 | codeClassName: 'dark:!bg-gray-900',
|
89 | 82 | },
|
90 | 83 | {
|
91 | 84 | title: 'Always open',
|
92 |
| - code: <Accordion items={items} />, |
| 85 | + code: <Accordion>{panels()}</Accordion>, |
93 | 86 | codeClassName: 'dark:!bg-gray-900',
|
94 | 87 | },
|
95 | 88 | {
|
96 | 89 | title: 'Flush accordion',
|
97 |
| - code: <Accordion items={items} flush />, |
| 90 | + code: <Accordion flush>{panels()}</Accordion>, |
98 | 91 | codeClassName: 'dark:!bg-gray-900',
|
99 | 92 | },
|
100 | 93 | {
|
101 | 94 | title: 'Arrow style',
|
102 |
| - code: <Accordion items={items} arrowIcon={HiOutlineArrowCircleDown} />, |
| 95 | + code: <Accordion>{panels(HiOutlineArrowCircleDown)}</Accordion>, |
103 | 96 | codeClassName: 'dark:!bg-gray-900',
|
104 | 97 | },
|
105 | 98 | ];
|
|
0 commit comments