# nexus-widgets

> My first package

Latest version **0.1.8** (published 2023-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install nexus-widgets
pnpm add nexus-widgets
yarn add nexus-widgets
bun add nexus-widgets
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2023-03-14 |
| First published | 2023-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 47.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Igor Gaponov |
| Maintainers | smith313428 |
| Keywords | react, typescript, awesome-project |

## Links

- npm: https://www.npmjs.com/package/nexus-widgets
- npm.io page: https://npm.io/package/nexus-widgets

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.8 (latest) — 2023-03-14
- 0.1.7 — 2023-03-03
- 0.1.6 — 2023-03-03
- 0.1.55 — 2023-03-02
- 0.1.54 — 2023-03-02
- 0.1.53 — 2023-03-02
- 0.1.52 — 2023-03-02
- 0.1.51 — 2023-03-02
- 0.1.5 — 2023-03-02
- 0.1.46 — 2023-03-02
- 0.1.45 — 2023-03-02
- 0.1.44 — 2023-03-02
- 0.1.43 — 2023-03-02
- 0.1.42 — 2023-03-02
- 0.1.11 — 2023-03-02
- … 5 more at https://npm.io/package/nexus-widgets/versions

## README

# Nexus widgets

> Easy to integrate react authentication management through context.
> Easy to integrate header into your nexus apps

## Features

- Dead simple to integrate
- Properly memoized authenticated attribute that can be consumed by your app

## Install

```shell
$ yarn add nexus-widgets
```

## Usage

Add `AuthProvider` somewhere towards the top of your tree. 

```tsx
// _app.tsx
import React from 'react';
import { AuthProvider} from "nexus-widgets";

function App() {

  return (
    <AuthProvider>
        <Component {...pageProps} />
    </AuthProvider>
  );
}
```

You can get authentication and user's photo infomation from AuthContext

```tsx
// index.tsx
import React from 'react';
import { AuthContext} from "nexus-widgets";

const Home: NextPage = () => {
    const { authenticated } = React.useContext(AuthContext);
    React.useEffect(() => {

    }, [authenticated]);
    return (
        <div className="bg-white">
            <Head>
                <title>Nexus Generator</title>
                <link className='stroke-1' rel="icon" href="./nexus1.png" />
            </Head>
            <Nexus />
        </div>
  )
}
```

```tsx
// layout.tsx
import React from 'react';
import { AuthContext} from "nexus-widgets";

const Layout = () => {
    const { userPhotoURL } = React.useContext(AuthContext);
    React.useEffect(() => {

    }, [authenticated]);
    return (
        <div className="bg-white">
            <Header
                avatar={userPhotoURL}
            />
        </div>
  )
}
```

Integrate setAuthenticated into your login and logout flow, here is an example of a login flow:

```tsx
// Login.tsx
import React from 'react';
import { AuthContext } from "nexus-widgets";

function Login(props: RouteComponentProps) {
  const { setAuthenticated } = React.useContext(AuthContext);
  return (
    <button type="button" onClick={() => setAuthenticated(true)}>
      Login
    </button>
    <button type="button" onClick={() => setAuthenticated(false)}>
      Logout
    </button>
  );
}
```

Integrate setUserPhotoURL into your user photo update logic:

```tsx
// Profile.tsx
import React from 'react';
import { AuthContext } from "nexus-widgets";

function Profile () {
  const { setUserPhotoURL } = React.useContext(AuthContext);
  return (
    <button type="button" onClick={() => setUserPhotoURL(url)}>
      Save user
    </button>
  );
}
```

Integrate header component to your app:

```tsx
// Layout.tsx
import React from 'react';
import {Header, AuthContext} from "nexus-widgets"

function Layout(props: RouteComponentProps) {
  const { userPhotoURL } = React.useContext(AuthContext);
  const handleMenu =()=>{
  }
  const handleInputChange =(value)=>{
  }
  return (
    <main>
        <div className="contentArea">
            <Header
                id = {"ads"}
                avatar={userPhotoURL}
                handleMenu={handleMenu}
                handleInputChange={handleInputChange}
            />
            <div fluid>
            <div>{children}</div>
            </div>
        </div>
    </main>
  );
}
```

---
_Source: https://npm.io/package/nexus-widgets · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
