Skip to content

Commit a0abd59

Browse files
docs: improve content of docs and components for #767 (#768)
* docs(styles): improve `<code>` styling * docs(accordion): improve docs text for `<Accordion />`` * docs(code content): reduce text size * docs(code-preview): move title outside of code preview component * docs(alert): update documentation for alerts * docs(avatar): finish documentation for the `<Avatar>` component * docs(badges): add unique text and docs for the `<Badge>` component * docs(code-preview): remove title prop * docs(breadcrumb): add additional docs and content to the `<Breadcrumb>` component * docs(buttons): finish docs for buttons page * docs(button group): finish new docs for button group component * chore(CNAME): remove CNAME file * docs(card): add new content for cards documentation * docs(carousel): update docs for carousel * docs(dropdown): update content for dropdown component * docs(footer): add footer content description * docs(list group): add docs for list group * docs(navbar): add docs for navbar * fix(theme): remove weird border styles from navbar by default * docs(progress): add content and description to progress bar * docs(rating): finish content writing for rating component * chore(progress): fix prettier formatting * docs(sidebar): update sidebar component docs * docs(sidebar): update default bg color to `gray-50` * docs(sidebar): finish sidebar docs * docs(spinner): finish docs for spinner component * docs(table): finish new docs content for tables * docs(footer): update footer link colors * docs(timeline): finish docs for timeline * docs(toast): add docs content for toast component * docs(tooltip): finish docs for tooltip * docs(tabs): add rounded styles to tabs by default * docs(tabs): add documentation and fix styles * docs(tabs): add text to all tabs for docs * docs(tabs): add component with state back in comments for to do * docs(modal): update modal docs content and fix some spacings * docs(tabs): add programatically setting tabs component * docs(pagination): fix docs content for pagination * docs(pagination): fix prettier warning * docs(forms): finish documentation for forms --------- Co-authored-by: Conner Davis <[email protected]>
1 parent 5200ecd commit a0abd59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3264
-1987
lines changed

CNAME

-1
This file was deleted.

app/components/code-preview.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface CodePreviewProps extends PropsWithChildren, ComponentProps<'div'> {
1818
title: string;
1919
}
2020

21-
export const CodePreview: FC<CodePreviewProps> = function ({ children, className, title }) {
21+
export const CodePreview: FC<CodePreviewProps> = function ({ children, className }) {
2222
const childrenList = Children.toArray(children);
2323
let code = childrenList.map((child) => reactElementToJSXString(child, reactElementToJSXStringOptions)).join('\n');
2424
code = deleteJSXSpaces(code);
@@ -28,7 +28,6 @@ export const CodePreview: FC<CodePreviewProps> = function ({ children, className
2828

2929
return (
3030
<div className="mb-12 flex w-full flex-col gap-2">
31-
<h2 className="text-2xl font-bold">{title}</h2>
3231
<div className={classNames('py-4', className)}>{children}</div>
3332
<pre className="language-tsx">
3433
<code>{code}</code>

app/docs.css

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
@apply font-medium text-gray-900 underline decoration-cyan-700 decoration-1 underline-offset-2 dark:text-white dark:decoration-cyan-700;
4848
}
4949

50+
#mainContent > p > code,
51+
#mainContent > ul > li > code,
52+
#mainContent > ol > li > code {
53+
@apply break-all px-1 font-mono text-sm text-primary-600 dark:text-primary-400;
54+
}
55+
5056
#mainContent > p > a:hover,
5157
#mainContent > div > p > a:hover,
5258
#mainContent > ul > li > a:hover,
@@ -108,7 +114,7 @@ pre[class*='language-'] {
108114
-ms-hyphens: none;
109115
hyphens: none;
110116

111-
@apply font-normal;
117+
@apply my-6 rounded-lg text-sm font-normal;
112118
}
113119

114120
/* without preview */

app/docs/components/accordion/accordion.mdx

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
import { Accordion } from '~/src/components/Accordion';
22
import { CodePreview } from '~/app/components/code-preview';
33

4-
The accordion component is a collection of vertically collapsing header and body elements that can be used to show and hide information based on the Tailwind CSS utility classes and JavaScript from Flowbite.
4+
The accordion component from Flowbite React can be used to toggle the visibility of the content of each accordion panel tab by expanding the collapsing the trigger element based on multiple examples and styles.
55

6-
A popular use case would be the “Frequently Asked Questions” section of a website or page when you can show questions and answers for each child element.
6+
The reactivity and state is handled by React and the components is built using the Tailwind CSS framework meaning that you can easily customize the styles and colors of the accordion.
7+
8+
To use the accordion component, you need to import the `<Accordion>` component from `flowbite-react`:
9+
10+
```jsx
11+
'use client';
12+
13+
import { Accordion } from 'flowbite-react';
14+
```
15+
16+
## Default accordion
17+
18+
Use this example of the `<Accordion>` component and the `<Accordion.Panel>` and `<Accordion.Title>` subcomponents to create an accordion with multiple panels.
719

820
<CodePreview title="Default accordion" className="dark:bg-gray-900">
921
<Accordion>
@@ -75,6 +87,11 @@ A popular use case would be the “Frequently Asked Questions” section of a we
7587
</Accordion.Panel>
7688
</Accordion>
7789
</CodePreview>
90+
91+
## Collapse all
92+
93+
Use this example to automatically collapse all of the accordion panels by passing the `collapseAll` prop to the `<Accordion>` component.
94+
7895
<CodePreview title="Collapse all" className="dark:bg-gray-900">
7996
<Accordion collapseAll>
8097
<Accordion.Panel>
@@ -145,3 +162,7 @@ A popular use case would be the “Frequently Asked Questions” section of a we
145162
</Accordion.Panel>
146163
</Accordion>
147164
</CodePreview>
165+
166+
## References
167+
168+
- [Flowbite Accordion](https://flowbite.com/docs/components/accordion/)

app/docs/components/accordion/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import AccordionPageContent from '.';
44

55
export const metadata: Metadata = {
66
description:
7-
'Use the accordion component to show hidden information based on the collapse and expand state of the child elements using data attribute options',
7+
'Use the accordion component and its options to expand and collapse the content inside each panel based on state reactivity from React and Tailwind CSS',
88
title: 'React Accordion - Flowbite',
99
};
1010

app/docs/components/alert/alert.mdx

+51-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,23 @@ import { ExampleAdditionalContent } from './additional-content.tsx';
33
import { HiInformationCircle } from 'react-icons/hi';
44
import { Alert } from '~/src';
55

6-
The alert component can be used to provide information to your users such as success or error messages, but also highlighted information complementing the normal flow of paragraphs and headers on a page. Flowbite also includes dismissable alerts which can be hidden by the users by clicking on the close icon.
6+
The alert component can be used to show a contextual text to the user such as a success or error message after form validation inside an alert box where you can choose from multiple colors, sizes, and styles.
7+
8+
The examples below are styled with Tailwind CSS and the reactivity is handled by React and you can also add any type of content inside the alert box.
9+
10+
To start using the alert box you need to import the `<Alert>` component from the `flowbite-react` package:
11+
12+
```jsx
13+
'use client';
14+
15+
import { Alert } from 'flowbite-react';
16+
```
17+
18+
## Default alert
19+
20+
The default alert component is a simple alert box with a text inside it and you can use the `color` prop to change the color of the alert box and the `title` prop to add a title to the alert box.
21+
22+
Inside of the `<Alert>` component you can add any type of content such as text, images, or other components as they will be considered children of the alert box.
723

824
<CodePreview title="Default alert">
925
<Alert color="info">
@@ -12,41 +28,71 @@ The alert component can be used to provide information to your users such as suc
1228
</span>
1329
</Alert>
1430
</CodePreview>
31+
32+
## Alert with icon
33+
34+
Use the `icon` prop to add an icon to the alert box and you can use any icon from the [React Icons](https://react-icons.github.io/react-icons/) library.
35+
1536
<CodePreview title="Alert with icon">
1637
<Alert color="failure" icon={HiInformationCircle}>
1738
<span>
1839
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
1940
</span>
2041
</Alert>
2142
</CodePreview>
43+
44+
## Dismissable alert
45+
46+
You can use the `onDismiss` prop on the `<Alert>` component to add a dismiss button to the alert box by adding a function inside of it that will be called when the user clicks on the dismiss button.
47+
2248
<CodePreview title="Dismissable alert">
2349
<Alert color="success" onDismiss={() => alert('Alert dismissed!')}>
2450
<span>
2551
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
2652
</span>
2753
</Alert>
2854
</CodePreview>
55+
56+
## Rounded alert
57+
58+
To make the alert box rounded you can use the `rounded` prop on the `<Alert>` component.
59+
2960
<CodePreview title="Rounded">
3061
<Alert color="warning" rounded>
3162
<span>
3263
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
3364
</span>
3465
</Alert>
3566
</CodePreview>
67+
68+
## Border accent
69+
70+
Add a border accent to the alert box by applying the `withBorderAccent` prop on the `<Alert>` component.
71+
3672
<CodePreview title="Border accent">
3773
<Alert color="warning" withBorderAccent>
3874
<span>
3975
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
4076
</span>
4177
</Alert>
4278
</CodePreview>
79+
80+
## Additional content
81+
82+
Add additional content by using the `additionalContent` prop and add any type of content inside of it.
83+
4384
<CodePreview title="Additional content">
4485
<Alert additionalContent={<ExampleAdditionalContent />} color="warning" icon={HiInformationCircle}>
4586
<span>
4687
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
4788
</span>
4889
</Alert>
4990
</CodePreview>
91+
92+
## All options
93+
94+
This is an example with all of the available options and props for the alert component.
95+
5096
<CodePreview title="All options">
5197
<Alert
5298
additionalContent={<ExampleAdditionalContent />}
@@ -60,3 +106,7 @@ The alert component can be used to provide information to your users such as suc
60106
</span>
61107
</Alert>
62108
</CodePreview>
109+
110+
## References
111+
112+
- [Flowbite Alerts](https://flowbite.com/docs/components/alerts/)

app/docs/components/alert/page.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { DocsContentLayout } from '~/app/components/docs-content-layout';
33
import AlertPageContent from '.';
44

55
export const metadata: Metadata = {
6-
description: 'Show contextual information to your users using alert elements based on Tailwind CSS',
6+
description:
7+
'Get started with the alert component to show contextual information to the user such as when validating forms or showing errors based on React and Tailwind CSS',
78
title: 'React Alert - Flowbite',
89
};
910

0 commit comments

Comments
 (0)