Skip to content

Commit 6992f1f

Browse files
authored
Merge pull request #67 from react18-tools/md-docs
Md docs
2 parents 769ff3b + 52a1d69 commit 6992f1f

File tree

65 files changed

+737
-2184
lines changed

Some content is hidden

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

65 files changed

+737
-2184
lines changed

docs/.nojekyll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

docs/README.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
**React18 Loaders**
2+
3+
***
4+
5+
# React18 Loaders <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 40px"/>
6+
7+
[![test](https://github.com/react18-tools/turborepo-template/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/turborepo-template/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/aa896ec14c570f3bb274/maintainability)](https://codeclimate.com/github/react18-tools/turborepo-template/maintainability) [![codecov](https://codecov.io/gh/react18-tools/turborepo-template/graph/badge.svg)](https://codecov.io/gh/react18-tools/turborepo-template) [![Version](https://img.shields.io/npm/v/react18-loaders.svg?colorB=green)](https://www.npmjs.com/package/react18-loaders) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/react18-loaders.svg)](https://www.npmjs.com/package/react18-loaders) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react18-loaders) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)
8+
9+
React18 Loaders is a comprehensive library designed to unlock the full potential of React 18 server components. It provides customizable loading animation components and a fullscreen loader container, seamlessly integrating with React and Next.js.
10+
11+
✅ Fully Treeshakable (import from `react18-loaders/client/loader-container`)
12+
13+
✅ Fully TypeScript Supported
14+
15+
✅ Leverages the power of React 18 Server components
16+
17+
✅ Compatible with all React 18 build systems/tools/frameworks
18+
19+
✅ Documented with [Typedoc](https://react18-tools.github.io/turborepo-template) ([Docs](https://react18-tools.github.io/turborepo-template))
20+
21+
✅ Examples for Next.js, and Vite
22+
23+
> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Star [this repository](https://github.com/react18-tools/turborepo-template) and share it with your friends.
24+
25+
## Getting Started
26+
27+
### Installation
28+
29+
```bash
30+
pnpm add react18-loaders
31+
```
32+
33+
**_or_**
34+
35+
```bash
36+
npm install react18-loaders
37+
```
38+
39+
**_or_**
40+
41+
```bash
42+
yarn add react18-loaders
43+
```
44+
45+
## Want Lite Version? [![npm bundle size](https://img.shields.io/bundlephobia/minzip/react18-loaders-lite)](https://www.npmjs.com/package/react18-loaders-lite) [![Version](https://img.shields.io/npm/v/react18-loaders-lite.svg?colorB=green)](https://www.npmjs.com/package/react18-loaders-lite) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/react18-loaders-lite.svg)](https://www.npmjs.com/package/react18-loaders-lite)
46+
47+
```bash
48+
pnpm add react18-loaders-lite
49+
```
50+
51+
**or**
52+
53+
```bash
54+
npm install react18-loaders-lite
55+
```
56+
57+
**or**
58+
59+
```bash
60+
yarn add react18-loaders-lite
61+
```
62+
63+
> You need `r18gs` as a peer-dependency
64+
65+
### Import Styles
66+
67+
You can import styles globally or within specific components.
68+
69+
```css
70+
/* globals.css */
71+
@import "react18-loaders/dist";
72+
```
73+
74+
```tsx
75+
// layout.tsx
76+
import "react18-loaders/dist/index.css";
77+
```
78+
79+
For selective imports:
80+
81+
```css
82+
/* globals.css */
83+
@import "react18-loaders/dist/client"; /** required if you are using LoaderContainer */
84+
@import "react18-loaders/dist/server/bars/bars1";
85+
```
86+
87+
### Usage
88+
89+
Using loaders is straightforward.
90+
91+
```tsx
92+
import { Bars1 } from "react18-loaders/dist/server/bars/bars1";
93+
94+
export default function MyComponent() {
95+
return someCondition ? <Bars1 /> : <>Something else...</>;
96+
}
97+
```
98+
99+
For detailed API and options, refer to [the API documentation](https://react18-tools.github.io/turborepo-template).
100+
101+
**Using LoaderContainer**
102+
103+
`LoaderContainer` is a fullscreen component. You can add this component directly in your layout and then use `useLoader` hook to toggle its visibility.
104+
105+
```tsx
106+
// layout.tsx
107+
<LoaderContainer />
108+
...
109+
```
110+
111+
```tsx
112+
// some other page or component
113+
import { useLoader } from "react18-loaders/dist/hooks";
114+
115+
export default MyComponent() {
116+
const { setLoading } = useLoader();
117+
useCallback(()=>{
118+
setLoading(true);
119+
...do some work
120+
setLoading(false);
121+
}, [])
122+
...
123+
}
124+
```
125+
126+
## License
127+
128+
This library is licensed under the MPL-2.0 open-source license.
129+
130+
> This package also serves as an example demonstrating how to build and publish a `React.js` library compatible with React Server Components.
131+
132+
> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Please enroll in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsor](https://github.com/sponsors/mayank1513) our work.
133+
134+
<hr />
135+
136+
<p align="center" style="text-align:center">with 💖 by <a href="https://mayank-chaudhari.vercel.app" target="_blank">Mayank Kumar Chaudhari</a></p>

docs/assets/hierarchy.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/highlight.css

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)