Skip to content

Commit

Permalink
Include usage examples in README
Browse files Browse the repository at this point in the history
  • Loading branch information
qrtp committed Oct 27, 2023
1 parent 1e7198c commit f09c6de
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 13 deletions.
63 changes: 52 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ environment are provided below.
- Staging: https://staging.ud.me/aaron.x
- Production: https://ud.me/quirk.x

## Usage

The React components contained in the `domain-profiles` project can be used in
your own project, and imported directly from NPM. Some of the components
available are:

- Unstoppable Messaging
- Token Gallery
- Wallet connect modal

### Installation

To use the Unstoppable Domains React components in your own project, install the
Expand All @@ -55,7 +45,58 @@ npm install react react-dom
yarn add react react-dom
```

### Developing
## Usage

The React components contained in the `domain-profiles` project can be used in
your own project, and imported directly from NPM. Some of the components
available are:

- Unstoppable Messaging
- Token Gallery
- Wallet connect modal

As an example, the following demonstrates how to add Unstoppable Messaging to your
existing Web3 React dApp.

```typescript
import Button from '@mui/material/Button';
import {
UnstoppableMessaging,
UnstoppableMessagingProvider,
Web3ContextProvider,
useUnstoppableMessaging,
} from '@unstoppabledomains/ui-components';

const myAddress = "0x123";
const myDomain = "mydomain.x";

const MyPage = () => {

const {setOpenChat} = useUnstoppableMessaging();

return (
<Web3ContextProvider>
<UnstoppableMessagingProvider>
<div>
<UnstoppableMessaging
address={myAddress}
domain={myDomain}
/>
</div>
<Button
onClick={() => setOpenChat("friend.x")}
>
Open chat
</Button>
</UnstoppableMessagingProvider>
</Web3ContextProvider>
)
}

export default as MyPage;
```

## Contributing

To contribute changes to the `domain-profiles` project, you'll need to clone the
project and build it in your local environment.
Expand Down
9 changes: 9 additions & 0 deletions packages/config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Change Log

All notable changes to this project will be documented in this file. This
project adheres to [Semantic Versioning](http://semver.org/).

## 0.0.2

- Update the README to include usage examples

## 0.0.1

- Initial version
60 changes: 60 additions & 0 deletions packages/config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Unstoppable Domains Config

A common configuration reference for Unstoppable Domains environments 🛠️

[![CI Status](https://github.com/unstoppabledomains/domain-profiles/actions/workflows/push.yml/badge.svg)](https://github.com/unstoppabledomains/domain-profiles/actions/workflows/push.yml)

### Installation

To use the Unstoppable Domains config in your own project, install the
module in your project directory:

```shell
// with npm
npm install --save @unstoppabledomains/config

// with yarn
yarn add @unstoppabledomains/config
```

## Usage

```typescript
import config from '@unstoppabledomains/config';

console.log("Unstoppable Domains smart contract", config.UNSTOPPABLE_CONTRACT_ADDRESS);
```

## Contributing

To contribute changes to the `domain-profiles` project, you'll need to clone the
project and build it in your local environment.

```shell
# Clone the project
git clone [email protected]:unstoppabledomains/domain-profiles.git
cd domain-profiles

# Build the project locally
yarn install # install dependencies
yarn build # build shared packages

# Run the development server
yarn workspace server run dev
```

### Testing

To run the tests (`src/**/*.test.tsx` files):

```shell
yarn test # run all tests
yarn test:ci # run all tests and generate coverage report
```

### Linting and code formatting

```shell
yarn lint # automatically fixes linting errors
yarn format # checks for formatting errors
```
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unstoppabledomains/config",
"version": "0.0.1",
"version": "0.0.2",
"private": true,
"description": "Configuration variables for Unstoppable Domains environments",
"homepage": "https://github.com/unstoppabledomains/domain-profiles#readme",
Expand Down
2 changes: 1 addition & 1 deletion scripts/copyPackageFiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ cd packages/ui-components \
&&
# Prepare the config package
cd packages/config \
&& cp -rf CHANGELOG.md ../../README.md ../../LICENSE build/src \
&& cp -rf CHANGELOG.md README.md ../../LICENSE build/src \
&& cat package.json | sed -e 's/build\/src\///g' | sed -e 's/workspace:\^/latest/g' | sed -e 's/"private": true/"private": false/g' > build/src/package.json \
&& cd ../../

0 comments on commit f09c6de

Please sign in to comment.