Skip to content
This repository was archived by the owner on Apr 14, 2020. It is now read-only.

Commit e8b23de

Browse files
authored
Merge pull request #101 from madou/container-grow
feat: Reshaping Container, SimpleReveal, Nested Baba's
2 parents 2fddeba + 55b9af8 commit e8b23de

File tree

46 files changed

+1455
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1455
-167
lines changed

README.md

+30-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
# yubaba
22

3-
is an element animation orchestrator for React.js ✨
3+
easy to use animations with powerful orchestration for React.js 🧙
44

5-
[![npm](https://img.shields.io/npm/v/yubaba.svg)](https://www.npmjs.com/package/yubaba)
6-
[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/yubaba.svg)](https://bundlephobia.com/result?p=yubaba)
5+
[![npm](https://img.shields.io/npm/v/yubaba.svg)](https://www.npmjs.com/package/yubaba) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/yubaba.svg)](https://bundlephobia.com/result?p=yubaba)
76

87
[![Example animation using yubaba](https://user-images.githubusercontent.com/6801309/55383683-87894b80-5574-11e9-80ef-7394eb6eca63.gif)](https://yubabajs.com/advanced-usage)
98

10-
## Why yubaba
9+
## What is yubaba???
1110

12-
`yubaba` is as much of a _platform_ as it is an **orchestrator**.
13-
It comes with prebuilt animations you can drop in and start using immediately,
14-
such as [ConcealMove](https://yubabajs.com/conceal-move) and [RevealMove](https://yubabajs.com/reveal-move) which together can [create an awesome user experience](https://yubabajs.com/advanced-usage) seen above!
11+
It's all about **animation** 🧙✨ - it can help with:
1512

16-
But even better you can create [_custom_ animations](https://yubabajs.com/custom-animations)!
17-
Using the same internals the [prebuilt animations use](https://yubabajs.com/getting-started),
18-
it comes with a first class customization experience for you to do,
19-
well,
20-
anything!
13+
- [Moving an element](https://yubabajs.com/move) from one position to another
14+
- [Revealing elements](https://yubabajs.com/focal-reveal-move) like you see above
15+
- [Supporting animations](https://yubabajs.com/supporting-animations) by obstructing elements in view; and
16+
- [Hiding children elements](https://yubabajs.com/advanced-usage#delay-showing-content-until-all-animations-have-finished) until animations have completed to trick users 🤫
17+
- [Orchestrating](https://yubabajs.com/advanced-usage#wait-for-the-previous-animation-to-finish-before-starting-the-next) when animations should happen and [in what order](https://yubabajs.com/advanced-usage#controlling-in-what-order-animations-should-execute)
18+
- Composing animations together to create composite animations, for example [CrossFadeMove](https://yubabajs.com/cross-fade-move)
19+
- [Anything you can imagine](https://yubabajs.com/custom-animations), seriously 🤩
2120

22-
## [Docs](https://yubabajs.com)
21+
## Installation
2322

24-
See the documentation at [yubabajs.com](https://yubabajs.com).
23+
`yubaba` has a peer dependency on [emotion](https://emotion.sh/docs/introduction) for some of the more advanced animations.
24+
25+
```bash
26+
npm install yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x --save
27+
```
28+
29+
or
30+
31+
```bash
32+
yarn add yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x
33+
```
34+
35+
## Next steps
36+
37+
- **First time** here? After installing head over to [Getting started](https://yubabajs.com/getting-started) to start learning the basics
38+
- Interested in **animating an element**? Check out [Focal animations](https://yubabajs.com/focal-animations)
39+
- For **ready made experiences** check out [Composite components](https://yubabajs.com/composite-components), just grab them and go!
40+
- Having **trouble**? Maybe [Troubleshooting](https://yubabajs.com/troubleshooting) has your answers

doczrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const pkg = require('./packages/yubaba/package.json');
22

33
module.exports = {
4-
title: 'yubaba docs',
4+
title: 'yubaba 🧙✨',
55
description: `yubaba ${pkg.description}`,
66
typescript: true,
77
dest: '/docs',

packages/yubaba/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"main": "dist/cjs/packages/yubaba/src/index.js",
88
"module": "dist/esm/packages/yubaba/src/index.js",
99
"sideEffects": false,
10-
"description": "is an element animation orchestrator for React.js ",
10+
"description": "easy to use animations with powerful orchestration for React.js 🧙",
1111
"keywords": [
1212
"react",
1313
"flip",
@@ -24,7 +24,7 @@
2424
},
2525
"size-limit": [
2626
{
27-
"limit": "6 KB",
27+
"limit": "7 KB",
2828
"path": "dist/esm/packages/yubaba/src/index.js"
2929
}
3030
],

packages/yubaba/src/Baba/index.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,22 @@ import noop from '../lib/noop';
2121
import * as babaStore from '../lib/babaStore';
2222
import { InjectedProps, withBabaManagerContext } from '../BabaManager';
2323

24-
2524
export type AnimationFunc = () => Promise<void>;
2625

27-
2826
export interface MappedAnimation {
2927
animate: AnimationFunc;
3028
beforeAnimate: AnimationFunc;
3129
afterAnimate: AnimationFunc;
3230
cleanup: () => void;
3331
}
3432

35-
3633
export type AnimationBlock = MappedAnimation[];
3734

38-
3935
export interface ChildProps {
4036
style?: InlineStyles;
4137
className?: string;
4238
}
4339

44-
4540
export interface State {
4641
shown: boolean;
4742
childProps: ChildProps;
@@ -481,6 +476,7 @@ If it's an image, try and have the image loaded before mounting, or set a static
481476

482477
return (
483478
<Collector
479+
topMostCollector
484480
receiveData={this.setData}
485481
receiveRenderChildren={this.setReactNode}
486482
receiveRef={this.setRef}
@@ -497,5 +493,4 @@ If it's an image, try and have the image loaded before mounting, or set a static
497493
}
498494
}
499495

500-
501496
export const WrappedBaba = withBabaManagerContext(Baba);

packages/yubaba/src/Collector/__docs__/docs.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: Collector
33
route: /collector
4+
menu: Utility helpers
45
---
56

67
import { Playground, PropsTable } from 'docz';

packages/yubaba/src/Collector/index.tsx

+14-10
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export interface CollectorProps extends CollectorChildrenProps {
8686
data?: CollectorData;
8787
style?: InlineStyles;
8888
className?: string;
89+
topMostCollector?: boolean;
8990
}
9091

9192
export interface Collect {
@@ -113,6 +114,7 @@ export default class Collector extends React.Component<CollectorProps> {
113114
receiveRenderChildren,
114115
receiveRef,
115116
receiveData,
117+
topMostCollector,
116118
} = this.props;
117119

118120
if (typeof children !== 'function') {
@@ -126,7 +128,7 @@ export default class Collector extends React.Component<CollectorProps> {
126128
receiveRef(ref);
127129
}
128130

129-
if (collect) {
131+
if (!topMostCollector && collect) {
130132
collect.ref(ref);
131133
}
132134
},
@@ -136,13 +138,13 @@ export default class Collector extends React.Component<CollectorProps> {
136138
receiveFocalTargetRef(ref);
137139
}
138140

139-
if (collect) {
141+
if (!topMostCollector && collect) {
140142
collect.focalTargetRef(ref);
141143
}
142144
},
143145
data: childData => {
144146
const collectedData = data ? [data].concat(childData) : childData;
145-
if (collect) {
147+
if (!topMostCollector && collect) {
146148
collect.data(collectedData);
147149
}
148150

@@ -151,7 +153,7 @@ export default class Collector extends React.Component<CollectorProps> {
151153
}
152154
},
153155
renderChildren: node => {
154-
if (collect) {
156+
if (!topMostCollector && collect) {
155157
collect.renderChildren(node);
156158
}
157159

@@ -161,9 +163,10 @@ export default class Collector extends React.Component<CollectorProps> {
161163
},
162164
style: {
163165
...style,
164-
...(collect ? collect.style : {}),
166+
...(collect && !topMostCollector ? collect.style : {}),
165167
},
166-
className: className || (collect ? collect.className : undefined),
168+
className:
169+
className || (collect && !topMostCollector ? collect.className : undefined),
167170
}}
168171
>
169172
{children}
@@ -177,7 +180,7 @@ export default class Collector extends React.Component<CollectorProps> {
177180
<CollectorContext.Consumer>
178181
{collect => {
179182
if (typeof children === 'function') {
180-
if (collect) {
183+
if (!topMostCollector && collect) {
181184
const collectedData = data ? [data] : [];
182185
collect.renderChildren(children);
183186
collect.data(collectedData);
@@ -189,17 +192,18 @@ export default class Collector extends React.Component<CollectorProps> {
189192

190193
return React.Children.only(
191194
children({
192-
className: className || (collect ? collect.className : undefined),
195+
className:
196+
className || (collect && !topMostCollector ? collect.className : undefined),
193197
ref: (ref: HTMLElement) => {
194-
if (collect) {
198+
if (!topMostCollector && collect) {
195199
collect.ref(ref);
196200
}
197201

198202
if (receiveRef) {
199203
receiveRef(ref);
200204
}
201205
},
202-
style: collect ? { ...style, ...collect.style } : style || {},
206+
style: collect && !topMostCollector ? { ...style, ...collect.style } : style || {},
203207
})
204208
);
205209
}

packages/yubaba/src/FocalTarget/__docs__/docs.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: FocalTarget
33
route: /focal-target
4+
menu: Focal animations
45
---
56

67
import { Playground, PropsTable } from 'docz';

packages/yubaba/src/Wait/__docs__/docs.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: Wait
33
route: /wait
4+
menu: Utility helpers
45
---
56

67
import { Playground, PropsTable } from 'docz';
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: 1. Introduction
2+
name: 1. Introduction 📖
33
route: /
44
order: 5
55
---
@@ -8,36 +8,41 @@ import EmailChain from '../3-advanced-usage/EmailChain';
88

99
# yubaba
1010

11-
is an element animation orchestrator for React.js ✨
11+
easy to use animations with powerful orchestration for React.js 🧙
1212

1313
[![npm](https://img.shields.io/npm/v/yubaba.svg)](https://www.npmjs.com/package/yubaba) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/yubaba.svg)](https://bundlephobia.com/result?p=yubaba)
1414

1515
<EmailChain />
1616

17-
## Why yubaba?
17+
## What is yubaba???
1818

19-
`yubaba` is as much of a _platform_ as much as it is an **orchestrator**.
20-
It can control when, where, and how to start animations and comes with prebuilt animations you can drop in and start using immediately,
21-
such as [ConcealMove](/conceal-move) and [RevealMove](/reveal-move)!
19+
It's all about **animation** 🧙✨ - it can help with:
2220

23-
Even better you can create _custom_ animations!
24-
Using the same [internals](/collector) the [prebuilt animations use](https://github.com/madou/yubaba/tree/master/packages/yubaba/src/animations),
25-
it comes with a first class customization experience for you to do,
26-
well,
27-
anything!
21+
- [Moving an element](/move) from one position to another
22+
- [Revealing elements](/focal-reveal-move) like you see above
23+
- [Supporting animations](/supporting-animations) by obstructing elements in view; and
24+
- [Hiding children elements](/advanced-usage#delay-showing-content-until-all-animations-have-finished) until animations have completed to trick users 🤫
25+
- [Orchestrating](/advanced-usage#wait-for-the-previous-animation-to-finish-before-starting-the-next) when animations should happen and [in what order](/advanced-usage#controlling-in-what-order-animations-should-execute)
26+
- Composing animations together to create composite animations, for example [CrossFadeMove](/cross-fade-move)
27+
- [Anything you can imagine](/custom-animations), seriously 🤩
2828

2929
## Installation
3030

3131
`yubaba` has a peer dependency on [emotion](https://emotion.sh/docs/introduction) for some of the more advanced animations.
3232

3333
```bash
34-
npm install yubaba [email protected] --save
34+
npm install yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x --save
3535
```
3636

3737
or
3838

3939
```bash
40-
yarn add yubaba [email protected]
40+
yarn add yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x
4141
```
4242

43-
> **Tip -** After installing head over to [Getting started](/getting-started) to start learning the basics!
43+
## Next steps
44+
45+
- **First time** here? After installing head over to [Getting started](/getting-started) to start learning the basics
46+
- Interested in **animating an element**? Check out [Focal animations](/focal-animations)
47+
- For **ready made experiences** check out [Composite components](/composite-components), just grab them and go!
48+
- Having **trouble**? Maybe [Troubleshooting](/troubleshooting) has your answers

packages/yubaba/src/__docs__/2-getting-started/docs.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: 2. Getting started
2+
name: 2. Getting started 🏃
33
route: /getting-started
44
order: 4
55
---

packages/yubaba/src/__docs__/3-advanced-usage/EmailChain.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from '@material-ui/core';
2222
import * as Styled from './styled';
2323
import { WrappedBaba as Baba } from '../../Baba';
24-
import RevealMove from '../../animations/RevealMove';
24+
import FocalRevealMove from '../../animations/FocalRevealMove';
2525
import ConcealMove from '../../animations/ConcealMove';
2626
import FocalTarget from '../../FocalTarget';
2727

@@ -41,7 +41,7 @@ const EmailChain = () => {
4141
{Styled.data.map((email, index) => (
4242
<React.Fragment key={index}>
4343
<Baba name={`card-${index}`} in={props.in}>
44-
<RevealMove duration={600}>
44+
<FocalRevealMove duration={600}>
4545
{baba => (
4646
<div {...baba}>
4747
<ListItem button>
@@ -57,7 +57,7 @@ const EmailChain = () => {
5757
</ListItem>
5858
</div>
5959
)}
60-
</RevealMove>
60+
</FocalRevealMove>
6161
</Baba>
6262
<Divider variant="inset" />
6363
</React.Fragment>

0 commit comments

Comments
 (0)