Skip to content

Commit a5d008e

Browse files
Docs/guides/adonis js (#1433)
* docs sidebar: cleanup old `isNew` badges * feat(web): docs/guides - add `AdonisJS` feat(cli): add `AdonisJS` * chore(ui): update README chore(web): add `AdonisJS` integration guide card in `quickstart` page * fix(docs): Dark mode `ThemeModeScript` render order * simplify tailwind.config->content
1 parent ba3463d commit a5d008e

File tree

7 files changed

+178
-18
lines changed

7 files changed

+178
-18
lines changed

.changeset/purple-rocks-divide.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-flowbite-react": patch
3+
"flowbite-react": patch
4+
---
5+
6+
add `AdonisJS` integration guide

apps/web/components/quickstart/integration-guides.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const GUIDES: Guide[] = [
1616
{ name: "Remix", slug: "/docs/guides/remix", logo: "remix.svg", invert: true },
1717
{ name: "Astro", slug: "/docs/guides/astro", logo: "astro.svg", invert: true },
1818
{ name: "Gatsby", slug: "/docs/guides/gatsby", logo: "gatsby.svg" },
19+
{ name: "AdonisJS", slug: "/docs/guides/adonis-js", logo: "adonis-js.svg", className: "p-2", invert: true },
1920
{ name: "RedwoodJS", slug: "/docs/guides/redwood-js", logo: "redwood-js.svg", className: "p-2" },
2021
{ name: "Laravel", slug: "/docs/guides/laravel", logo: "laravel.svg" },
2122
{ name: "Vite", slug: "/docs/guides/vite", logo: "vite.svg" },
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
title: Use with AdonisJS - Flowbite React
3+
description: Learn how to install Flowbite React for your AdonisJS project and start developing modern full-stack web applications
4+
---
5+
6+
## Using the CLI
7+
8+
Run the following command to scaffold a new `Flowbite React` project using `AdonisJS`:
9+
10+
```bash
11+
# npm
12+
npm create flowbite-react@latest -- --template adonisjs
13+
14+
# yarn
15+
yarn create flowbite-react --template adonisjs
16+
17+
# pnpm
18+
pnpm create flowbite-react@latest --template adonisjs
19+
20+
# bun
21+
bun create flowbite-react@latest --template adonisjs
22+
```
23+
24+
<TextDivider>Manual Installation</TextDivider>
25+
26+
## Create project
27+
28+
Run the following command to create a new AdonisJS project using the CLI:
29+
30+
```bash
31+
npm init adonisjs@latest -- -K=inertia --adapter=react --ssr --install
32+
```
33+
34+
## Setup Tailwind CSS
35+
36+
1. Install `tailwindcss` and its peer dependencies:
37+
38+
```bash
39+
npm i -D tailwindcss postcss autoprefixer
40+
```
41+
42+
2. Generate `tailwind.config.js` and `postcss.config.js` files:
43+
44+
```bash
45+
npx tailwindcss init -p
46+
```
47+
48+
3. Add the paths to all of your template files in your `tailwind.config.js` file:
49+
50+
```js {3}
51+
/** @type {import('tailwindcss').Config} */
52+
export default {
53+
content: ["./inertia/**/*.{js,ts,jsx,tsx}", "./resources/**/*.{edge,js,ts,jsx,tsx}"],
54+
theme: {
55+
extend: {},
56+
},
57+
plugins: [],
58+
};
59+
```
60+
61+
4. Add the `@tailwind` directives for each of Tailwind's layers to your `./inertia/css/app.css` file:
62+
63+
```css
64+
@tailwind base;
65+
@tailwind components;
66+
@tailwind utilities;
67+
```
68+
69+
## Install Flowbite React
70+
71+
1. Run the following command to install `flowbite-react`:
72+
73+
```bash
74+
npm i flowbite-react
75+
```
76+
77+
2. Add the Flowbite React `content` path and `plugin` to `tailwind.config.js`:
78+
79+
```js {1,7,11}
80+
import flowbite from "flowbite-react/tailwind";
81+
82+
/** @type {import('tailwindcss').Config} */
83+
export default {
84+
content: [
85+
// ...
86+
flowbite.content(),
87+
],
88+
plugins: [
89+
// ...
90+
flowbite.plugin(),
91+
],
92+
};
93+
```
94+
95+
## Dark mode
96+
97+
In server side rendered applications, such as AdonisJS, to avoid page flicker (if `dark` mode is set) before AdonisJS hydrates the content, `ThemeModeScript` component must be rendered (see implementation below).
98+
99+
`ThemeModeScript` renders a script tag that sets `dark` or removes `dark` from `<html>` element before hydration occurs.
100+
101+
### Configure
102+
103+
1. Import and render `ThemeModeScript` in the return body of `setup` function:
104+
105+
```tsx {4,15-20}
106+
// inertia/app/ssr.tsx
107+
108+
import { createInertiaApp } from "@inertiajs/react";
109+
import { ThemeModeScript } from "flowbite-react";
110+
import ReactDOMServer from "react-dom/server";
111+
112+
export default function render(page: any) {
113+
return createInertiaApp({
114+
page,
115+
render: ReactDOMServer.renderToString,
116+
resolve: (name) => {
117+
const pages = import.meta.glob("../pages/**/*.tsx", { eager: true });
118+
return pages[`../pages/${name}.tsx`];
119+
},
120+
setup: ({ App, props }) => (
121+
<>
122+
<ThemeModeScript />
123+
<App {...props} />
124+
</>
125+
),
126+
});
127+
}
128+
```
129+
130+
## Try it out
131+
132+
Now that you have successfully installed Flowbite React you can start using the components from the library.
133+
134+
```tsx
135+
// inertia/pages/home.tsx
136+
137+
import { Button } from "flowbite-react";
138+
139+
export default function Home() {
140+
return <Button>Click me</Button>;
141+
}
142+
```
143+
144+
<hr />
145+
146+
## Templates
147+
148+
- [Github](https://github.com/themesberg/flowbite-react-template-adonisjs)
149+
- [StackBlitz](https://stackblitz.com/edit/flowbite-react-template-adonisjs)

apps/web/data/docs-sidebar.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export const DOCS_SIDEBAR: DocsSidebarSection[] = [
1818
items: [
1919
{ title: "Introduction", href: "/docs/getting-started/introduction" },
2020
{ title: "Quickstart", href: "/docs/getting-started/quickstart" },
21-
{ title: "CLI", href: "/docs/getting-started/cli", isNew: true },
22-
{ title: "Editor Setup", href: "/docs/getting-started/editor-setup", isNew: true },
23-
{ title: "Server Components", href: "/docs/getting-started/server-components", isNew: true },
21+
{ title: "CLI", href: "/docs/getting-started/cli" },
22+
{ title: "Editor Setup", href: "/docs/getting-started/editor-setup" },
23+
{ title: "Server Components", href: "/docs/getting-started/server-components" },
2424
{ title: "License", href: "/docs/getting-started/license" },
2525
{ title: "Changelog", href: "https://github.com/themesberg/flowbite-react/releases", isExternal: true },
2626
{ title: "Contributing", href: "/docs/getting-started/contributing" },
@@ -30,15 +30,16 @@ export const DOCS_SIDEBAR: DocsSidebarSection[] = [
3030
title: "integration guides",
3131
href: "/guides/",
3232
items: [
33-
{ title: "Next.js", href: "/docs/guides/next-js", isNew: true },
34-
{ title: "Remix", href: "/docs/guides/remix", isNew: true },
35-
{ title: "Astro", href: "/docs/guides/astro", isNew: true },
36-
{ title: "Gatsby", href: "/docs/guides/gatsby", isNew: true },
37-
{ title: "RedwoodJS", href: "/docs/guides/redwood-js", isNew: true },
38-
{ title: "Laravel", href: "/docs/guides/laravel", isNew: true },
39-
{ title: "Vite", href: "/docs/guides/vite", isNew: true },
40-
{ title: "Parcel", href: "/docs/guides/parcel", isNew: true },
41-
{ title: "Create React App", href: "/docs/guides/create-react-app", isNew: true },
33+
{ title: "Next.js", href: "/docs/guides/next-js" },
34+
{ title: "Remix", href: "/docs/guides/remix" },
35+
{ title: "Astro", href: "/docs/guides/astro" },
36+
{ title: "Gatsby", href: "/docs/guides/gatsby" },
37+
{ title: "AdonisJS", href: "/docs/guides/adonis-js", isNew: true },
38+
{ title: "RedwoodJS", href: "/docs/guides/redwood-js" },
39+
{ title: "Laravel", href: "/docs/guides/laravel" },
40+
{ title: "Vite", href: "/docs/guides/vite" },
41+
{ title: "Parcel", href: "/docs/guides/parcel" },
42+
{ title: "Create React App", href: "/docs/guides/create-react-app" },
4243
],
4344
},
4445
{
@@ -57,19 +58,19 @@ export const DOCS_SIDEBAR: DocsSidebarSection[] = [
5758
{ title: "Alert", href: "/docs/components/alert" },
5859
{ title: "Avatar", href: "/docs/components/avatar" },
5960
{ title: "Badge", href: "/docs/components/badge" },
60-
{ title: "Banner", href: "/docs/components/banner", isNew: true },
61+
{ title: "Banner", href: "/docs/components/banner" },
6162
{ title: "Breadcrumb", href: "/docs/components/breadcrumb" },
6263
{ title: "Button", href: "/docs/components/button" },
6364
{ title: "Button group", href: "/docs/components/button-group" },
6465
{ title: "Card", href: "/docs/components/card" },
6566
{ title: "Carousel", href: "/docs/components/carousel" },
6667
{ title: "Clipboard", href: "/docs/components/clipboard", isNew: true },
67-
{ title: "Datepicker", href: "/docs/components/datepicker", isNew: true },
68+
{ title: "Datepicker", href: "/docs/components/datepicker" },
6869
{ title: "Drawer", href: "/docs/components/drawer", isNew: true },
6970
{ title: "Dropdown", href: "/docs/components/dropdown" },
7071
{ title: "Footer", href: "/docs/components/footer" },
7172
{ title: "Forms", href: "/docs/components/forms" },
72-
{ title: "KBD", href: "/docs/components/kbd", isNew: true },
73+
{ title: "KBD", href: "/docs/components/kbd" },
7374
{ title: "List group", href: "/docs/components/list-group" },
7475
{ title: "Mega menu", href: "/docs/components/mega-menu", isNew: true },
7576
{ title: "Modal", href: "/docs/components/modal" },
@@ -92,15 +93,15 @@ export const DOCS_SIDEBAR: DocsSidebarSection[] = [
9293
href: "/forms/",
9394
items: [
9495
{ title: "File Input", href: "/docs/forms/file-input" },
95-
{ title: "Floating Label", href: "/docs/forms/floating-label", isNew: true },
96+
{ title: "Floating Label", href: "/docs/forms/floating-label" },
9697
],
9798
},
9899
{
99100
title: "typography",
100101
href: "/typography/",
101102
items: [
102-
{ title: "Blockquote", href: "/docs/typography/blockquote", isNew: true },
103-
{ title: "List", href: "/docs/typography/list", isNew: true },
103+
{ title: "Blockquote", href: "/docs/typography/blockquote" },
104+
{ title: "List", href: "/docs/typography/list" },
104105
{ title: "HR", href: "/docs/typography/hr", isNew: true },
105106
],
106107
},

apps/web/public/logos/adonis-js.svg

Lines changed: 1 addition & 0 deletions
Loading

packages/cli/src/data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const REPOS: { key: string; name: string; url: string }[] = [
55
{ key: "remix", name: "Remix", url: "https://github.com/themesberg/flowbite-react-template-remix.git" },
66
{ key: "astro", name: "Astro", url: "https://github.com/themesberg/flowbite-react-template-astro.git" },
77
{ key: "gatsby", name: "Gatsby", url: "https://github.com/themesberg/flowbite-react-template-gatsby.git" },
8+
{ key: "adonisjs", name: "AdonisJS", url: "https://github.com/themesberg/flowbite-react-template-adonisjs.git" },
89
{ key: "redwoodjs", name: "RedwoodJS", url: "https://github.com/themesberg/flowbite-react-template-redwoodjs.git" },
910
{ key: "laravel", name: "Laravel", url: "https://github.com/themesberg/flowbite-react-template-laravel.git" },
1011
{ key: "vite", name: "Vite", url: "https://github.com/themesberg/flowbite-react-template-vite.git" },

packages/ui/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ To manually install `flowbite-react` into your application, here is a list of th
8484
- [Remix](https://www.flowbite-react.com/docs/guides/remix)
8585
- [Astro](https://www.flowbite-react.com/docs/guides/astro)
8686
- [Gatsby](https://www.flowbite-react.com/docs/guides/gatsby)
87+
- [AdonisJS](https://www.flowbite-react.com/docs/guides/adonis-js)
8788
- [RedwoodJS](https://www.flowbite-react.com/docs/guides/redwood-js)
8889
- [Laravel](https://www.flowbite-react.com/docs/guides/laravel)
8990
- [Vite](https://www.flowbite-react.com/docs/guides/vite)

0 commit comments

Comments
 (0)