Skip to content

Commit

Permalink
chore: add headless react components to markdown docs (#241)
Browse files Browse the repository at this point in the history
This just extends #136 to add the new components to the markdown docs in
the `docs/` dir. I pretty much just copied over the doc comments, so
nothing really ground breaking here :)

Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
Co-authored-by: Travis Vachon <travis.vachon@gmail.com>
Co-authored-by: Nathan Vander Wilt <natevw@yahoo.com>
  • Loading branch information
4 people authored Jan 19, 2023
1 parent 7150c8c commit 0d851a9
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/react-keyring.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,34 @@ import * as ReactKeyring from '@w3ui/react-keyring'

## Exports

* [`Authenticator`](#authenticator)
* [`Authenticator.Form`](#authenticatorform)
* [`Authenticator.Email`](#authenticatoremail)
* [`Authenticator.CancelButton`](#authenticatorcancelbutton)
* [`KeyringProvider`](#keyringprovider)
* [`useKeyring`](#usekeyring)

---

### `Authenticator`

Headless component providing agent and space creation and registration functionality. The `Authenticator`
component is designed to be used by [`Authenticator.Form`](#authenticatorform), [`Authenticator.Email`](#authenticatoremail) and other "markup components" when implementing an authentication UI.

Must be used inside of a [`KeyringProvider`](#keyringprovider).

#### `Authenticator.Form`

A `form` element designed to work with the [`Authenticator`](#authenticator) component. Any passed props will be passed along to the `form` element.

#### `Authenticator.Email`

An email `input` element designed to work with [`Authenticator.Form`](#authenticatorform). Any passed props will be passed along to the `input` component.

#### `Authenticator.CancelButton`

A `button` element that will cancel space registration, designed to work with [`Authenticator.Form`](#authenticatorform). Any passed props will be passed along to the `button` element.

### `KeyringProvider`

Provider for managing agent creation, key management, and space registration with the service.
Expand Down
23 changes: 23 additions & 0 deletions docs/react-uploader.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,34 @@ import * as ReactUploader from '@w3ui/react-uploader'

## Exports

* [`Uploader`](#uploader)
* [`Uploader.Form`](#uploaderform)
* [`Uploader.Input`](#uploaderinput)
* [`UploaderProvider`](#uploaderprovider)
* [`useUploader`](#useuploader)

---

### `Uploader`

Top-level component of the headless Uploader.

Designed to be used with [`Uploader.Form`](#uploaderform) and [`Uploader.Input`](#uploaderinput) to easily create a custom component for uploading files to web3.storage.

#### `Uploader.Form`

Form component for the headless Uploader.

Renders a `form` element designed to work with [`Uploader`](#uploader) that will send files from an [`Uploader.Input`](#uploaderinput) component to the web3.storage service when the form is submitted.

Any passed props will be passed along to the `input` element.

#### `Uploader.Input`

Input component for the headless Uploader.

Renders a file `input` element designed to work with [`Uploader`](#uploader). When used inside of an [`Uploader.Form`](#uploaderform), files added to the input will be uploaded when the form is submitted.

### `UploaderProvider`

Provider for an `Uploader` which allows uploads to the service. Note that this provider uses [`useKeyring`](./react-keyring#usekeyring) and provides an `uploader` only when an Agent with a registered space is loaded.
Expand Down
25 changes: 25 additions & 0 deletions docs/react-uploads-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,36 @@ import * as ReactUploadsList from '@w3ui/react-uploads-list'

## Exports

* [`UploadsList`](#uploadslist)
* [`UploadsList.NextButton`](#uploadslistnextbutton)
* [`UploadsList.ReloadButton`](#uploadslistreloadbutton)
* [`UploadsListProvider`](#uploadslistprovider)
* [`useUploadsList`](#useuploadslist)

---

### `UploadsList`

Top-level component of the headless UploadsList.

Designed to be used with [`UploadsList.NextButton`](#uploadslistnextbutton), [`UploadsList.ReloadButton`](#uploadslistreloadbutton), etc to easily create a custom component for listing uploads in a web3.storage space.

#### `UploadsList.NextButton`

Button that loads the next page of results in an UploadsList.

Renders a `button` element designed to work with [`UploadsList`](#uploadslist). When pressed, will request the next page of uploads from the service.

Any passed props will be passed along to the `button` element.

#### `UploadsList.ReloadButton`

Button that reloads an UploadsList.

Renders a `button` element designed to work with [`UploadsList`](#uploadslist). When pressed, will reload list data from the service.

Any passed props will be passed along to the `button` element.

### `UploadsListProvider`

Provider for a list of items uploaded by the current agent. Note that this provider uses [`useKeyring`](./react-keyring.md#usekeyring) to obtain the current agent's identity.
Expand Down

0 comments on commit 0d851a9

Please sign in to comment.