### Install Emotion for React Styling
Source: https://arwes.dev/docs/develop
Command to install Emotion, a popular CSS-in-JS library, for styling Arwes components in React applications. It provides tools for dynamic and component-based styling.
```bash
npm install @emotion/react
```
--------------------------------
### Install Arwes React Package
Source: https://arwes.dev/docs/develop
Command to install the Arwes React package. This package includes all vanilla and React-specific packages needed for Arwes integration.
```bash
npm install @arwes/react@1.0.0-alpha.23
```
--------------------------------
### Setup Global Sound Effects with BleepsProvider
Source: https://arwes.dev/docs/develop
Configuring global sound effects for an Arwes application using `BleepsProvider`. This allows any child component to access and play defined sound effects, such as intro and click sounds.
```javascript
import {
type BleepsProviderSettings,
BleepsProvider
} from '@arwes/react';
const bleepsSettings: BleepsProviderSettings = {
// Shared global audio settings.
master: {
volume: 0.9
},
bleeps: {
// A transition bleep sound to play when the user enters the app.
intro: {
sources: [
{ src: 'https://arwes.dev/assets/sounds/intro.mp3', type: 'audio/mpeg' }
]
},
// An interactive bleep sound to play when user clicks.
click: {
sources: [
{ src: 'https://arwes.dev/assets/sounds/click.mp3', type: 'audio/mpeg' }
]
}
}
};
const App = (): ReactElement => {
return (
{/* ... */}
);
};
```
--------------------------------
### Implement Animated Background Effects
Source: https://arwes.dev/docs/develop
Example of creating animated background effects for an Arwes application using components like `GridLines`, `Dots`, and `MovingLines`. These are applied within an `Animator` component.
```javascript
import { GridLines, Dots, MovingLines } from '@arwes/react';
const Background = (): ReactElement => {
return (
);
};
const App = (): ReactElement => {
return (
<>
{/* ... */}
>
);
};
```
--------------------------------
### Apply Arwes Theme and Styles Baseline with Emotion
Source: https://arwes.dev/docs/develop
Example of applying Arwes's global baseline styles and theme using Emotion's `` component in a React application. This sets up the fundamental visual appearance.
```javascript
import { type CSSObject, Global } from '@emotion/react';
import { createAppTheme, createAppStylesBaseline } from '@arwes/react';
const theme = createAppTheme();
const stylesBaseline = createAppStylesBaseline(theme);
const App = (): ReactElement => {
return (
<>
} />
{/* ... */}
>
);
};
```
--------------------------------
### Disable React Strict Mode in Next.js
Source: https://arwes.dev/docs/develop
Configuration for Next.js projects to disable React strict mode, which is not compatible with Arwes. This is a crucial step for initial setup.
```javascript
// next.config.js
module.exports = {
reactStrictMode: false
};
```
--------------------------------
### Root Animator Component for Child Animations
Source: https://arwes.dev/docs/develop
Example of a root `Animator` component in React to manage animations of its children. It demonstrates how to control animations using props like `combine`, `manager`, and `active`.
```javascript
import { useState } from 'react';
import { Animator } from '@arwes/react';
const App = (): ReactElement => {
const [active] = useState(true);
return (
{/* ... */}
);
};
```
--------------------------------
### Create a Customizable Card Component with Animations
Source: https://arwes.dev/docs/develop
Demonstrates creating a reusable card component in React using Arwes. It includes features like sound effect integration (`useBleeps`, `BleepsOnAnimator`), animated text (`Animated`, `aaVisibility`, `aa`), and SVG frame decorations (`FrameSVGCorners`).
```javascript
import {
useBleeps,
BleepsOnAnimator,
Animated,
FrameSVGCorners,
Text,
aa,
aaVisibility
} from '@arwes/react';
const Card = (): ReactElement => {
const bleeps = useBleeps();
return (
{/* Play the intro bleep when card appears. */}
bleeps.click?.play()}
>
{/* Frame decoration and shape colors defined by CSS. */}