Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
14afa33
docs(styles): improve `<code>` styling
zoltanszogyenyi May 26, 2023
ef68099
docs(accordion): improve docs text for `<Accordion />``
zoltanszogyenyi May 26, 2023
b062ce7
docs(code content): reduce text size
zoltanszogyenyi May 26, 2023
334c640
docs(code-preview): move title outside of code preview component
zoltanszogyenyi May 26, 2023
7e4ba34
docs(alert): update documentation for alerts
zoltanszogyenyi May 26, 2023
a9b8e4e
docs(avatar): finish documentation for the `<Avatar>` component
zoltanszogyenyi May 26, 2023
1604f4d
docs(badges): add unique text and docs for the `<Badge>` component
zoltanszogyenyi May 26, 2023
3d2fc5e
docs(code-preview): remove title prop
zoltanszogyenyi May 26, 2023
6065ce5
docs(breadcrumb): add additional docs and content to the `<Breadcrumb…
zoltanszogyenyi May 26, 2023
6d9df0a
docs(buttons): finish docs for buttons page
zoltanszogyenyi May 26, 2023
4d78930
docs(button group): finish new docs for button group component
zoltanszogyenyi May 26, 2023
54ecb9b
chore(CNAME): remove CNAME file
zoltanszogyenyi May 27, 2023
175eee7
docs(card): add new content for cards documentation
zoltanszogyenyi May 27, 2023
cd36e77
docs(carousel): update docs for carousel
zoltanszogyenyi May 27, 2023
03cc744
docs(dropdown): update content for dropdown component
zoltanszogyenyi May 27, 2023
08ad3af
docs(footer): add footer content description
zoltanszogyenyi May 27, 2023
4be121a
docs(list group): add docs for list group
zoltanszogyenyi May 27, 2023
2c07372
docs(navbar): add docs for navbar
zoltanszogyenyi May 27, 2023
ea19521
fix(theme): remove weird border styles from navbar by default
zoltanszogyenyi May 27, 2023
bb817b9
docs(progress): add content and description to progress bar
zoltanszogyenyi May 28, 2023
4366845
docs(rating): finish content writing for rating component
zoltanszogyenyi May 28, 2023
dc576c3
chore(progress): fix prettier formatting
zoltanszogyenyi May 28, 2023
9b75304
docs(sidebar): update sidebar component docs
zoltanszogyenyi May 29, 2023
17f3510
docs(sidebar): update default bg color to `gray-50`
zoltanszogyenyi May 29, 2023
8472533
docs(sidebar): finish sidebar docs
zoltanszogyenyi May 29, 2023
1a49227
docs(spinner): finish docs for spinner component
zoltanszogyenyi May 29, 2023
40dfadd
docs(table): finish new docs content for tables
zoltanszogyenyi May 29, 2023
afde840
docs(footer): update footer link colors
zoltanszogyenyi May 29, 2023
2b4249f
docs(timeline): finish docs for timeline
zoltanszogyenyi May 29, 2023
7ee8d84
docs(toast): add docs content for toast component
zoltanszogyenyi May 29, 2023
6da5630
docs(tooltip): finish docs for tooltip
zoltanszogyenyi May 29, 2023
e55a7a5
docs(tabs): add rounded styles to tabs by default
zoltanszogyenyi May 29, 2023
30520d0
docs(tabs): add documentation and fix styles
zoltanszogyenyi May 29, 2023
23f46aa
docs(tabs): add text to all tabs for docs
zoltanszogyenyi May 29, 2023
b10fb9f
docs(tabs): add component with state back in comments for to do
zoltanszogyenyi May 30, 2023
a2b4179
docs(modal): update modal docs content and fix some spacings
zoltanszogyenyi May 30, 2023
3803fd7
docs(tabs): add programatically setting tabs component
zoltanszogyenyi May 30, 2023
18d1957
docs(pagination): fix docs content for pagination
zoltanszogyenyi May 30, 2023
162e780
docs(pagination): fix prettier warning
zoltanszogyenyi May 30, 2023
137ad21
docs(forms): finish documentation for forms
zoltanszogyenyi May 30, 2023
51154da
Merge branch 'main' into improve-docs-content-767
zoltanszogyenyi May 30, 2023
270206b
Merge branch 'main' into improve-docs-content-767
tulup-conner May 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

3 changes: 1 addition & 2 deletions app/components/code-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface CodePreviewProps extends PropsWithChildren, ComponentProps<'div'> {
title: string;
}

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

return (
<div className="mb-12 flex w-full flex-col gap-2">
<h2 className="text-2xl font-bold">{title}</h2>
<div className={classNames('py-4', className)}>{children}</div>
<pre className="language-tsx">
<code>{code}</code>
Expand Down
8 changes: 7 additions & 1 deletion app/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
@apply font-medium text-gray-900 underline decoration-cyan-700 decoration-1 underline-offset-2 dark:text-white dark:decoration-cyan-700;
}

#mainContent > p > code,
#mainContent > ul > li > code,
#mainContent > ol > li > code {
@apply break-all px-1 font-mono text-sm text-primary-600 dark:text-primary-400;
}

#mainContent > p > a:hover,
#mainContent > div > p > a:hover,
#mainContent > ul > li > a:hover,
Expand Down Expand Up @@ -108,7 +114,7 @@ pre[class*='language-'] {
-ms-hyphens: none;
hyphens: none;

@apply font-normal;
@apply my-6 rounded-lg text-sm font-normal;
}

/* without preview */
Expand Down
25 changes: 23 additions & 2 deletions app/docs/components/accordion/accordion.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import { Accordion } from '~/src/components/Accordion';
import { CodePreview } from '~/app/components/code-preview';

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.
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.

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.
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.

To use the accordion component, you need to import the `<Accordion>` component from `flowbite-react`:

```jsx
'use client';

import { Accordion } from 'flowbite-react';
```

## Default accordion

Use this example of the `<Accordion>` component and the `<Accordion.Panel>` and `<Accordion.Title>` subcomponents to create an accordion with multiple panels.

<CodePreview title="Default accordion" className="dark:bg-gray-900">
<Accordion>
Expand Down Expand Up @@ -75,6 +87,11 @@ A popular use case would be the “Frequently Asked Questions” section of a we
</Accordion.Panel>
</Accordion>
</CodePreview>

## Collapse all

Use this example to automatically collapse all of the accordion panels by passing the `collapseAll` prop to the `<Accordion>` component.

<CodePreview title="Collapse all" className="dark:bg-gray-900">
<Accordion collapseAll>
<Accordion.Panel>
Expand Down Expand Up @@ -145,3 +162,7 @@ A popular use case would be the “Frequently Asked Questions” section of a we
</Accordion.Panel>
</Accordion>
</CodePreview>

## References

- [Flowbite Accordion](https://flowbite.com/docs/components/accordion/)
2 changes: 1 addition & 1 deletion app/docs/components/accordion/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AccordionPageContent from '.';

export const metadata: Metadata = {
description:
'Use the accordion component to show hidden information based on the collapse and expand state of the child elements using data attribute options',
'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',
title: 'React Accordion - Flowbite',
};

Expand Down
52 changes: 51 additions & 1 deletion app/docs/components/alert/alert.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@ import { ExampleAdditionalContent } from './additional-content.tsx';
import { HiInformationCircle } from 'react-icons/hi';
import { Alert } from '~/src';

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.
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.

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.

To start using the alert box you need to import the `<Alert>` component from the `flowbite-react` package:

```jsx
'use client';

import { Alert } from 'flowbite-react';
```

## Default alert

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.

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.

<CodePreview title="Default alert">
<Alert color="info">
Expand All @@ -12,41 +28,71 @@ The alert component can be used to provide information to your users such as suc
</span>
</Alert>
</CodePreview>

## Alert with icon

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.

<CodePreview title="Alert with icon">
<Alert color="failure" icon={HiInformationCircle}>
<span>
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
</span>
</Alert>
</CodePreview>

## Dismissable alert

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.

<CodePreview title="Dismissable alert">
<Alert color="success" onDismiss={() => alert('Alert dismissed!')}>
<span>
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
</span>
</Alert>
</CodePreview>

## Rounded alert

To make the alert box rounded you can use the `rounded` prop on the `<Alert>` component.

<CodePreview title="Rounded">
<Alert color="warning" rounded>
<span>
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
</span>
</Alert>
</CodePreview>

## Border accent

Add a border accent to the alert box by applying the `withBorderAccent` prop on the `<Alert>` component.

<CodePreview title="Border accent">
<Alert color="warning" withBorderAccent>
<span>
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
</span>
</Alert>
</CodePreview>

## Additional content

Add additional content by using the `additionalContent` prop and add any type of content inside of it.

<CodePreview title="Additional content">
<Alert additionalContent={<ExampleAdditionalContent />} color="warning" icon={HiInformationCircle}>
<span>
<span className="font-medium">Info alert!</span> Change a few things up and try submitting again.
</span>
</Alert>
</CodePreview>

## All options

This is an example with all of the available options and props for the alert component.

<CodePreview title="All options">
<Alert
additionalContent={<ExampleAdditionalContent />}
Expand All @@ -60,3 +106,7 @@ The alert component can be used to provide information to your users such as suc
</span>
</Alert>
</CodePreview>

## References

- [Flowbite Alerts](https://flowbite.com/docs/components/alerts/)
3 changes: 2 additions & 1 deletion app/docs/components/alert/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { DocsContentLayout } from '~/app/components/docs-content-layout';
import AlertPageContent from '.';

export const metadata: Metadata = {
description: 'Show contextual information to your users using alert elements based on Tailwind CSS',
description:
'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',
title: 'React Alert - Flowbite',
};

Expand Down
Loading