Skip to content

Commit

Permalink
Apply changesets and update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Jun 26, 2024
1 parent b0a459b commit 6ab2ebc
Showing 1 changed file with 31 additions and 75 deletions.
106 changes: 31 additions & 75 deletions lib/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
# React Mouse Trail <img src="https://github.com/react18-tools/react-mouse-trail/blob/main/popper.png?raw=true" style="height: 40px"/>

[![test](https://github.com/react18-tools/react-mouse-trail/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/react-mouse-trail/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/aa896ec14c570f3bb274/maintainability)](https://codeclimate.com/github/react18-tools/react-mouse-trail/maintainability) [![codecov](https://codecov.io/gh/react18-tools/react-mouse-trail/graph/badge.svg)](https://codecov.io/gh/react18-tools/react-mouse-trail) [![Version](https://img.shields.io/npm/v/react-mouse-trail.svg?colorB=green)](https://www.npmjs.com/package/react-mouse-trail) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/react-mouse-trail.svg)](https://www.npmjs.com/package/react-mouse-trail) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-mouse-trail) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)
[![test](https://github.com/react18-tools/react-mouse-trail/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/react-mouse-trail/actions/workflows/test.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/4bb3a3316ff4ecd2a9eb/maintainability)](https://codeclimate.com/github/react18-tools/react-mouse-trail/maintainability) [![codecov](https://codecov.io/gh/react18-tools/react-mouse-trail/graph/badge.svg)](https://codecov.io/gh/react18-tools/react-mouse-trail) [![Version](https://img.shields.io/npm/v/react-mouse-trails.svg?colorB=green)](https://www.npmjs.com/package/react-mouse-trails) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/react-mouse-trails.svg)](https://www.npmjs.com/package/react-mouse-trails) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-mouse-trails) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)

React Mouse Trail 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.
A lightweight WebGL-based React component for creating an interactive mouse trail effect. Works with Next.js out of the box.

✅ Fully Treeshakable (import from `react-mouse-trail/client/loader-container`)

✅ Fully TypeScript Supported
✅ Fully TypeScript

✅ Leverages the power of React 18 Server components

✅ Compatible with all React 18 build systems/tools/frameworks
✅ Compatible with all React build systems/tools/frameworks

✅ Documented with [Typedoc](https://react18-tools.github.io/react-mouse-trail) ([Docs](https://react18-tools.github.io/react-mouse-trail))

✅ Examples for Next.js, Vite, and Remix
✅ Examples for Next.js, Vite

> <img src="https://github.com/react18-tools/react-mouse-trail/blob/main/popper.png?raw=true" style="height: 20px"/> Please consider starring [this repository](https://github.com/react18-tools/react-mouse-trail) and sharing it with your friends.
Expand All @@ -23,108 +21,66 @@ React Mouse Trail is a comprehensive library designed to unlock the full potenti
### Installation

```bash
$ pnpm add react-mouse-trail
$ pnpm add react-mouse-trails
```

**_or_**

```bash
$ npm install react-mouse-trail
$ npm install react-mouse-trails
```

**_or_**

```bash
$ yarn add react-mouse-trail
```

## Want Lite Version? [![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-mouse-trail-lite)](https://www.npmjs.com/package/react-mouse-trail-lite) [![Version](https://img.shields.io/npm/v/react-mouse-trail-lite.svg?colorB=green)](https://www.npmjs.com/package/react-mouse-trail-lite) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/react-mouse-trail-lite.svg)](https://www.npmjs.com/package/react-mouse-trail-lite)

```bash
$ pnpm add react-mouse-trail-lite
$ yarn add react-mouse-trails
```

**or**
### Adding CSS

```bash
$ npm install react-mouse-trail-lite
```
You can import CSS in your global styles or from your component. In the case of Next.js, you can import global styles only in `layout` or `_app` components.

**or**

```bash
$ yarn add react-mouse-trail-lite
```

> You need `r18gs` as a peer-dependency
### Import Styles

You can import styles globally or within specific components.
In your stylesheet

```css
/* globals.css */
@import "react-mouse-trail/dist";
@import "react-mouse-trails/dist";
```

```tsx
// layout.tsx
or in your component

```ts
import "react-mouse-trail/dist/index.css";
```

For selective imports:
Here's a revised version of the usage section:

```css
/* globals.css */
@import "react-mouse-trail/dist/client"; /** required if you are using LoaderContainer */
@import "react-mouse-trail/dist/server/bars/bars1";
```
## Usage

### Usage

Using loaders is straightforward.
MouseTrail is simple to integrate:

```tsx
import { Bars1 } from "react-mouse-trail/dist/server/bars/bars1";

export default function MyComponent() {
return someCondition ? <Bars1 /> : <>Something else...</>;
import { MouseTrail } from "react-mouse-trail";

export default function Layout() {
return (
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
{/* ... */}
<MouseTrail rgb={[1, 0, 0]} />
</body>
</html>
);
}
```

For detailed API and options, refer to [the API documentation](https://react18-tools.github.io/react-mouse-trail).

**Using LoaderContainer**

`LoaderContainer` is a fullscreen component. You can add this component directly in your layout and then use `useLoader` hook to toggle its visibility.

```tsx
// layout.tsx
<LoaderContainer />
...
```
By default, the RGB value `[1, 0, 0]` represents the color red.

```tsx
// some other page or component
import { useLoader } from "react-mouse-trail/dist/hooks";

export default MyComponent() {
const { setLoading } = useLoader();
useCallback(()=>{
setLoading(true);
...do some work
setLoading(false);
}, [])
...
}
```
![Repobeats](https://repobeats.axiom.co/api/embed/016960ad97aa7b1abbdd9a615f5ffeb08d869cb6.svg "Repobeats analytics image")

## License

This library is licensed under the MPL-2.0 open-source license.



> <img src="https://github.com/react18-tools/react-mouse-trail/blob/main/popper.png?raw=true" style="height: 20px"/> Please consider enrolling in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsoring](https://github.com/sponsors/mayank1513) our work.
<hr />
Expand Down

0 comments on commit 6ab2ebc

Please sign in to comment.