-
Notifications
You must be signed in to change notification settings - Fork 54
BREAKING(Transition): renamed Transition to Animation and added docs for the animations #505
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
There was a problem hiding this 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?
docs/src/views/Theming.tsx
Outdated
<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 |
There was a problem hiding this comment.
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'
docs/src/views/Theming.tsx
Outdated
<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 |
There was a problem hiding this comment.
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
Note, PR title would be "docs(theming):..." |
docs/src/views/Theming.tsx
Outdated
].join('\n')} | ||
render={() => ( | ||
<div> | ||
<Transition animationName="spinner"> |
There was a problem hiding this comment.
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=..."?
There was a problem hiding this comment.
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.
docs/src/views/Theming.tsx
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
docs/src/views/Theming.tsx
Outdated
<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 |
There was a problem hiding this comment.
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.
import { Animation, Icon } from '@stardust-ui/react' | ||
|
||
const AnimationExample = () => ( | ||
<Animation name="spinner"> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
docs/src/views/Theming.tsx
Outdated
<ExampleSnippet | ||
value={[ | ||
`<Animation name="spinner" delay="2s" duration="1s"><Icon name="user" circular /></Animation>`, | ||
`<Icon name="book" animation="spinner" delay="5s" duration="2s" circular/>`, |
There was a problem hiding this comment.
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/>
There was a problem hiding this comment.
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
Outdated
<Animation name="spinner" delay="2s" duration="1s"> | ||
<Icon name="user" circular /> | ||
</Animation> | ||
<Icon name="book" animation="spinner" delay="5s" duration="2s" circular /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
animation
-> object
docs/src/views/Theming.tsx
Outdated
|
||
<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{' '} |
There was a problem hiding this comment.
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'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{'This animation will start after 5 seconds'} | |
This animation will start after 5 seconds |
Are brackets necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
…e and removed it form the teams' theme
# Conflicts: # CHANGELOG.md
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 toAnimation
, and theanimationName
property toname
, following the review comments.