Skip to content

Commit

Permalink
chore(deps): update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Su-Yong committed Aug 25, 2024
1 parent 5b7d054 commit a4ae530
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ npm install solid-flip
const [show, setShow] = createSignal(false);
<Flip id={'my-flip-id'} with={show()}> // set `with` property that will be used to determine whether the content should be animated
<Flip id={'my-flip-id'} with={show()}> // set `with` property that will be used to determine when the content should be animated
<div class={show() ? 'show' : 'hidden'}>Animated content</div>
</Flip>
```
Expand Down Expand Up @@ -132,9 +132,25 @@ https://github.com/user-attachments/assets/0547a512-7032-4cce-940f-512de78538ef
</div>
```

# Usage
# API
## FlipProvider
`FlipProvider` component is used to wrap the root component of your application. It provides the context for the flip animation.
If you don't wrap your root component with `FlipProvider`, the flip animation will not work.

## Flip
> TODO
`Flip` component is used to wrap the content that you want to animate. It directly passes children.

| Property | Type | Default | Description |
|------------|------------------------|--------------|----------------------------------------------------------------|
| id | `string` | _(required)_ | The unique id of the flip component |
| with | `unknown \| unknown[]` | [] | The condition to determine when the content should be animated |
| duration | `number` | 300 | The duration of the animation |
| easing | `string` | 'ease' | The easing of the animation |
| properties | `string \| string[]` | [] | The additional properties that will be animated |

## Unflip
> TODO
`Unflip` component is used to warp the content that ignore parent flip animation. It directly passes children.

| Property | Type | Default | Description |
|----------|----------|---------|----------------------------------------|
| id | `string` | - | A parent id that ignore flip animation |
8 changes: 6 additions & 2 deletions examples/basic/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ export const App = () => {
</section>

<section>
<h1>Flip with <code>Property(with)</code></h1>
<h1>Flip with <code>Property(with)</code> + Unflip</h1>
<Flip id={'flip2'} with={flip2()}>
<div class={flip2() ? 'card blue fullscreen' : 'card red'} onClick={() => setFlip2(!flip2())}>
{flip2() ? 'Click Again!' : 'Click!'}
<Unflip>
<div>
{flip2() ? 'Click Again!' : 'Click!'}
</div>
</Unflip>
</div>
</Flip>
</section>
Expand Down

0 comments on commit a4ae530

Please sign in to comment.