Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

BREAKING(Transition): renamed Transition to Animation and added docs for the animations #505

Merged
merged 10 commits into from
Nov 27, 2018

Conversation

mnajdova
Copy link
Contributor

@mnajdova mnajdova commented Nov 20, 2018

This PR is adding docs about how the animations should be defined in the theme, and used together with the Transition component, as well as the animation property.

Update

As part of this PR, I am going to also rename the Transition component to Animation, and the animationName property to name, following the review comments.

@codecov
Copy link

codecov bot commented Nov 20, 2018

Codecov Report

Merging #505 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #505   +/-   ##
=======================================
  Coverage   88.17%   88.17%           
=======================================
  Files          42       42           
  Lines        1455     1455           
  Branches      187      187           
=======================================
  Hits         1283     1283           
  Misses        167      167           
  Partials        5        5
Impacted Files Coverage Δ
src/components/Animation/Animation.tsx 90.47% <100%> (ø)
src/index.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb583a7...dbcfcd7. Read the comment docs.

Copy link
Member

@miroslavstastny miroslavstastny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first question which comes to my mind is *when I should use Transition and when animation? In the original animation PR, there was a clear description and comparison of the two. Would it make sense to add similar description here as well?

<NavLink to="components/provider">Provider</NavLink>.
</p>
<p>
This is done with the Provider's <code>theme</code> prop. The animations are then are applied
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The animations are then are applied
remove the second 'are'

<p>
This is done with the Provider's <code>theme</code> prop. The animations are then are applied
based on their name by using the <NavLink to="components/transition">Transition</NavLink>{' '}
component, or the <code>animation</code> property available on all UI component. Here's how we
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: all UI component - I would rather write something like all Stardust components

@levithomason
Copy link
Member

Note, PR title would be "docs(theming):..."

].join('\n')}
render={() => (
<div>
<Transition animationName="spinner">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This strikes me as odd, "Transition animationName=..." Should we rename this "Transition name=..." or "Animation name=..."?

Copy link
Contributor Author

@mnajdova mnajdova Nov 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, I will rename the Transition component to Animation, as that is the word we use for describing this behavior everywhere else. Transition was just picked up because of SUIR. Then we can safely rename the animationName prop to name. I will add this changes to this PR too.

@@ -208,6 +208,82 @@ export default () => (
<NavLink to="components/provider">Provider</NavLink> at the root of your app.
</p>

<Header as="h2" content="Animations" />
<p>
Another important part of the theming in Stardust are the <code>animations</code>. You can
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another important part of the theming in Stardust are the animations.

This line doesn't add any value to the user's goal. Suggest removing it.

<Header as="h2" content="Animations" />
<p>
Another important part of the theming in Stardust are the <code>animations</code>. You can
define the animations in a very similar way as you would define them using css, by providing a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest:

You define animations in Stardust in a very similar way to CSS, by providing keyframes and animation properties.

Then show a minal provider code snippet immediately following this.

@mnajdova mnajdova changed the title feat(docs): Adding docs for defining the animations in the theme feat(theming): Adding docs for defining the animations in the theme Nov 21, 2018
@mnajdova mnajdova changed the title feat(theming): Adding docs for defining the animations in the theme BREAKING(animation): renamed Transition to Animation and Added docs for defining the animations in the theme Nov 22, 2018
@mnajdova mnajdova changed the title BREAKING(animation): renamed Transition to Animation and Added docs for defining the animations in the theme BREAKING(animation): renamed Transition to Animation and added docs for defining the animations in the theme Nov 22, 2018
import { Animation, Icon } from '@stardust-ui/react'

const AnimationExample = () => (
<Animation name="spinner">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the Animation examples are theme dependent. Would it make more sense to add Provider to the examples and explicitly define the animations there?
Not sure about that, would like to hear other opinions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your point, but I don't think this is good idea, because we will have much code in the examples, for something that is documented in the Theming guide. How the animation are created will be document as part of the theming guidem and the default theme will have few animations that will be shown in the examples. Let's hear the opinion from the other folks too. @kuzhelov @Bugaa92 @alinais @levithomason @layershifter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a similar problem in #451, we definitely need to show theme specific stuff because examples can be broken when you will try to switch to another theme.

I understand your point, but I don't think this is good idea, because we will have much code in the examples, for something that is documented in the Theming guide.

This is a valid point, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After offline discussion we decided to add the Provider with the theme. All examples as well as the Theming.tsx guide page, now contains a Provider where the animations are defined.

<ExampleSnippet
value={[
`<Animation name="spinner" delay="2s" duration="1s"><Icon name="user" circular /></Animation>`,
`<Icon name="book" animation="spinner" delay="5s" duration="2s" circular/>`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

animation here should be an object:

<Icon name="book" animation={{name: "spinner", delay:"5s", duration:"2s"}} circular/>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, thanks for the catch!

docs/src/views/Theming.tsx Show resolved Hide resolved
<Animation name="spinner" delay="2s" duration="1s">
<Icon name="user" circular />
</Animation>
<Icon name="book" animation="spinner" delay="5s" duration="2s" circular />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

animation -> object


<p>
The difference between using the Animation component versus the animation property is that,
the Animation component can be safely use for applying animations on{' '}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use -> used

-renamed Animation theme interface to AnimationProp, because of conflicts with the Animation component name

const AnimationExampleDelay = () => (
<div>
{'This animation will start after 5 seconds'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{'This animation will start after 5 seconds'}
This animation will start after 5 seconds

Are brackets necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@mnajdova mnajdova changed the title BREAKING(animation): renamed Transition to Animation and added docs for defining the animations in the theme BREAKING(animation): renamed Transition to Animation and added docs Nov 27, 2018
@mnajdova mnajdova changed the title BREAKING(animation): renamed Transition to Animation and added docs BREAKING: renamed Transition to Animation and added docs for the animations Nov 27, 2018
@mnajdova mnajdova changed the title BREAKING: renamed Transition to Animation and added docs for the animations reafactor: renamed Transition to Animation and added docs for the animations Nov 27, 2018
@mnajdova mnajdova changed the title reafactor: renamed Transition to Animation and added docs for the animations breaking(animations): renamed Transition to Animation and added docs for the animations Nov 27, 2018
@mnajdova mnajdova changed the title breaking(animations): renamed Transition to Animation and added docs for the animations breaking(Transition): renamed Transition to Animation and added docs for the animations Nov 27, 2018
@mnajdova mnajdova changed the title breaking(Transition): renamed Transition to Animation and added docs for the animations feat(Transition): renamed Transition to Animation and added docs for the animations Nov 27, 2018
@mnajdova mnajdova changed the title feat(Transition): renamed Transition to Animation and added docs for the animations BREAKING(Transition): renamed Transition to Animation and added docs for the animations Nov 27, 2018
@mnajdova mnajdova merged commit 49362ad into master Nov 27, 2018
@layershifter layershifter deleted the doc/animation-theme branch January 10, 2019 11:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants