Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mathdroid/react-moon-toggle

🌕🌑 Toggle and animate based on moon phases emoji
https://github.com/mathdroid/react-moon-toggle

Last synced: 5 days ago
JSON representation

🌕🌑 Toggle and animate based on moon phases emoji

Awesome Lists containing this project

README

        

# `react-moon-toggle`

> Toggle dark mode (or anything) in moon phases emoji

## Usage

```js
import React from "react";
import Toggle from "react-moon-toggle";

const app = () => {
const [dark, setDark] = React.useState(false);

return ;
};
```

## Installation

```sh
$ yarn add react-moon-toggle
```

## Props

- `dark` boolean (_required_)

- `setDark` = `(newDark: boolean) => null` ?function

- `interval` = `50` number

- `darkIndex` = `0` number (0-7)

- `lightIndex` = `4` number (0-7)

- `peekOnHover` = `true` boolean

phases array used for indexes:

```js
const phases = ["🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"];
```

Any other props will be given directly to the `` element.

## License

MIT