`,
- ``,
+ ``,
].join('\n')}
render={() => (
)}
/>
The difference between using the Animation component versus the animation property is that,
- the Animation component can be safely use for applying animations on{' '}
+ the Animation component can be safely used for applying animations on{' '}
all components (Stardust, custom and third party components). For the Stardust
components, we recommend using the animation property as there will be no wrapper element
added just for the purpose of defining the animation. For more details, please see the
diff --git a/src/components/Animation/Animation.tsx b/src/components/Animation/Animation.tsx
index aeab1df71c..d8e4a46da5 100644
--- a/src/components/Animation/Animation.tsx
+++ b/src/components/Animation/Animation.tsx
@@ -2,7 +2,7 @@ import * as PropTypes from 'prop-types'
import * as React from 'react'
import { UIComponent, customPropTypes, childrenExist } from '../../lib'
-import { Animation as ThemeAnimation } from '../../themes/types'
+import { AnimationProp } from '../../themes/types'
import createAnimationStyles from '../../lib/createAnimationStyles'
import { ChildrenComponentProps, StyledComponentProps } from '../../lib/commonPropInterfaces'
import { styledComponentPropTypes, childrenComponentPropTypes } from '../../lib/commonPropTypes'
@@ -97,7 +97,7 @@ class Animation extends UIComponent {
renderComponent({ ElementType, classes, rest, styles, variables, theme }) {
const { children, name } = this.props
- const animation: ThemeAnimation = {
+ const animation: AnimationProp = {
name,
duration: this.props.duration,
delay: this.props.delay,
diff --git a/src/lib/commonPropInterfaces.ts b/src/lib/commonPropInterfaces.ts
index 5219498303..22b831cf5a 100644
--- a/src/lib/commonPropInterfaces.ts
+++ b/src/lib/commonPropInterfaces.ts
@@ -1,4 +1,4 @@
-import { ComponentVariablesInput, ComponentSlotStyle, Animation } from '../themes/types'
+import { ComponentVariablesInput, ComponentSlotStyle, AnimationProp } from '../themes/types'
import { ShorthandValue, ReactChildren } from '../../types/utils'
export interface StyledComponentProps {
@@ -11,7 +11,7 @@ export interface StyledComponentProps
{
export interface AnimatedComponentProps {
/** Generic animation property that can be used for applying different theme animations. */
- animation?: Animation
+ animation?: AnimationProp
}
export interface UIComponentProps
extends StyledComponentProps
, AnimatedComponentProps {
diff --git a/src/lib/createAnimationStyles.tsx b/src/lib/createAnimationStyles.tsx
index 96ed98bdfa..d0dca5e19f 100644
--- a/src/lib/createAnimationStyles.tsx
+++ b/src/lib/createAnimationStyles.tsx
@@ -1,7 +1,7 @@
-import { ThemePrepared, Animation } from '../themes/types'
+import { ThemePrepared, AnimationProp } from '../themes/types'
import { callable } from './index'
-const createAnimationStyles = (animation: Animation, theme: ThemePrepared) => {
+const createAnimationStyles = (animation: AnimationProp, theme: ThemePrepared) => {
let animationCSSProp = {}
const { animations = {} } = theme
diff --git a/src/themes/types.ts b/src/themes/types.ts
index 9b2b9c8804..e2cb1f04e7 100644
--- a/src/themes/types.ts
+++ b/src/themes/types.ts
@@ -115,7 +115,7 @@ export interface ComponentSlotStylesPrepared
export interface ComponentSlotClasses extends ObjectOf {}
export interface ComponentSlotClasses extends ObjectOf {}
-export type Animation =
+export type AnimationProp =
| {
name: string
delay?: string
From 5ec08a535adfe91526ad6a81164f634286fa72e9 Mon Sep 17 00:00:00 2001
From: manajdov
Date: Mon, 26 Nov 2018 11:21:18 +0100
Subject: [PATCH 6/7] -removed unnecessary brackets
---
.../components/Animation/Types/AnimationExampleDelay.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx b/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx
index c9743d009d..4ef1ce9411 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx
@@ -3,7 +3,7 @@ import { Animation, Icon } from '@stardust-ui/react'
const AnimationExampleDelay = () => (
- {'This animation will start after 5 seconds'}
+ This animation will start after 5 seconds
From f06bfe804ff8f82805ececf380d6d0eb73a968d6 Mon Sep 17 00:00:00 2001
From: manajdov
Date: Mon, 26 Nov 2018 19:57:45 +0100
Subject: [PATCH 7/7] -added Provider with animations in the examples and
theming guide page and removed it form the teams' theme
---
.../Animation/Types/AnimationExample.tsx | 23 +++++--
.../Animation/Types/AnimationExampleDelay.tsx | 23 +++++--
.../Types/AnimationExampleDirection.tsx | 53 +++++++++-----
.../Types/AnimationExampleDuration.tsx | 23 +++++--
.../Types/AnimationExampleFillMode.tsx | 49 ++++++++-----
.../Types/AnimationExampleIterationCount.tsx | 53 +++++++++-----
.../Types/AnimationExamplePlayState.tsx | 47 ++++++++-----
.../Types/AnimationExampleTimingFunction.tsx | 69 +++++++++++--------
docs/src/views/Theming.tsx | 64 +++++++++++++----
src/themes/teams/index.ts | 24 -------
10 files changed, 278 insertions(+), 150 deletions(-)
diff --git a/docs/src/examples/components/Animation/Types/AnimationExample.tsx b/docs/src/examples/components/Animation/Types/AnimationExample.tsx
index fa4dbdffdd..1401bcbaf6 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExample.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExample.tsx
@@ -1,10 +1,25 @@
import * as React from 'react'
-import { Animation, Icon } from '@stardust-ui/react'
+import { Animation, Icon, Provider } from '@stardust-ui/react'
+
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
const AnimationExample = () => (
-
-
-
+
+
+
+
+
)
export default AnimationExample
diff --git a/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx b/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx
index 4ef1ce9411..870798c023 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExampleDelay.tsx
@@ -1,13 +1,28 @@
import * as React from 'react'
-import { Animation, Icon } from '@stardust-ui/react'
+import { Animation, Icon, Provider } from '@stardust-ui/react'
+
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
const AnimationExampleDelay = () => (
This animation will start after 5 seconds
-
-
-
+
+
+
+
+
)
diff --git a/docs/src/examples/components/Animation/Types/AnimationExampleDirection.tsx b/docs/src/examples/components/Animation/Types/AnimationExampleDirection.tsx
index 0db89cbb91..5582331bab 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExampleDirection.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExampleDirection.tsx
@@ -1,25 +1,40 @@
import * as React from 'react'
-import { Animation, Icon, Grid, Text } from '@stardust-ui/react'
+import { Animation, Icon, Grid, Text, Provider } from '@stardust-ui/react'
+
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
const AnimationExampleDirection = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
export default AnimationExampleDirection
diff --git a/docs/src/examples/components/Animation/Types/AnimationExampleDuration.tsx b/docs/src/examples/components/Animation/Types/AnimationExampleDuration.tsx
index 23b4160e68..a1792c9f13 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExampleDuration.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExampleDuration.tsx
@@ -1,10 +1,25 @@
import * as React from 'react'
-import { Animation, Icon } from '@stardust-ui/react'
+import { Animation, Icon, Provider } from '@stardust-ui/react'
+
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
const AnimationExampleDuration = () => (
-
-
-
+
+
+
+
+
)
export default AnimationExampleDuration
diff --git a/docs/src/examples/components/Animation/Types/AnimationExampleFillMode.tsx b/docs/src/examples/components/Animation/Types/AnimationExampleFillMode.tsx
index ebe56d5239..cf5712cf13 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExampleFillMode.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExampleFillMode.tsx
@@ -1,25 +1,36 @@
import * as React from 'react'
-import { Animation, Icon, Grid, Text } from '@stardust-ui/react'
+import { Animation, Icon, Grid, Text, Provider } from '@stardust-ui/react'
+
+const colorChanger = {
+ keyframe: {
+ from: { color: 'red' },
+ to: { color: 'blue' },
+ },
+ duration: '3s',
+ iterationCount: 'infinite',
+}
const AnimationExampleFillMode = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
export default AnimationExampleFillMode
diff --git a/docs/src/examples/components/Animation/Types/AnimationExampleIterationCount.tsx b/docs/src/examples/components/Animation/Types/AnimationExampleIterationCount.tsx
index 9f55d0cae8..bfa4b025b7 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExampleIterationCount.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExampleIterationCount.tsx
@@ -1,25 +1,40 @@
import * as React from 'react'
-import { Animation, Icon, Grid, Text } from '@stardust-ui/react'
+import { Animation, Icon, Grid, Text, Provider } from '@stardust-ui/react'
+
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
const AnimationExampleIterationCount = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
export default AnimationExampleIterationCount
diff --git a/docs/src/examples/components/Animation/Types/AnimationExamplePlayState.tsx b/docs/src/examples/components/Animation/Types/AnimationExamplePlayState.tsx
index a5a1016369..92c440c528 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExamplePlayState.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExamplePlayState.tsx
@@ -1,7 +1,20 @@
import React from 'react'
-import { Icon, Button, Animation } from '@stardust-ui/react'
+import { Icon, Button, Animation, Provider } from '@stardust-ui/react'
-class IconExample extends React.Component {
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
+
+class AnimationExamplePlayState extends React.Component {
state = {
playState: 'running',
}
@@ -14,21 +27,23 @@ class IconExample extends React.Component {
render() {
return (
-
+
+
+
)
}
}
-export default IconExample
+export default AnimationExamplePlayState
diff --git a/docs/src/examples/components/Animation/Types/AnimationExampleTimingFunction.tsx b/docs/src/examples/components/Animation/Types/AnimationExampleTimingFunction.tsx
index d62b1132af..1442b14d7f 100644
--- a/docs/src/examples/components/Animation/Types/AnimationExampleTimingFunction.tsx
+++ b/docs/src/examples/components/Animation/Types/AnimationExampleTimingFunction.tsx
@@ -1,33 +1,48 @@
import * as React from 'react'
-import { Animation, Icon, Grid, Text } from '@stardust-ui/react'
+import { Animation, Icon, Grid, Text, Provider } from '@stardust-ui/react'
+
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
const AnimationExampleTimingFunction = () => (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
export default AnimationExampleTimingFunction
diff --git a/docs/src/views/Theming.tsx b/docs/src/views/Theming.tsx
index 25d166638c..5a5412daa5 100644
--- a/docs/src/views/Theming.tsx
+++ b/docs/src/views/Theming.tsx
@@ -6,6 +6,19 @@ import { Button, Divider, Icon, Provider, Text, Animation } from '@stardust-ui/r
import DocPage from '../components/DocPage/DocPage'
import ExampleSnippet from '../components/ExampleSnippet/ExampleSnippet'
+const spinner = {
+ keyframe: {
+ from: {
+ transform: 'rotate(0deg)',
+ },
+ to: {
+ transform: 'rotate(360deg)',
+ },
+ },
+ duration: '5s',
+ iterationCount: 'infinite',
+}
+
export default () => (
@@ -268,12 +281,14 @@ export default () => (
``,
].join('\n')}
render={() => (
-
+
+
+
)}
/>
@@ -292,16 +307,37 @@ export default () => (
`,
- `
`,
+ `
`,
+ ` `,
+ ` `,
+ ``,
].join('\n')}
render={() => (
-
+
+
+
)}
/>
diff --git a/src/themes/teams/index.ts b/src/themes/teams/index.ts
index e349095a6d..24d24a1bca 100644
--- a/src/themes/teams/index.ts
+++ b/src/themes/teams/index.ts
@@ -34,29 +34,6 @@ Object.keys(fontIcons).forEach(iconName => {
icons[iconName] = declareFontBased(fontIcons[iconName])
})
-const animations = {
- spinner: {
- keyframe: {
- from: {
- transform: 'rotate(0deg)',
- },
- to: {
- transform: 'rotate(360deg)',
- },
- },
- duration: '5s',
- iterationCount: 'infinite',
- },
- colorChanger: {
- keyframe: {
- from: { color: 'red' },
- to: { color: 'blue' },
- },
- duration: '3s',
- iterationCount: 'infinite',
- },
-}
-
export default {
siteVariables,
componentVariables,
@@ -64,5 +41,4 @@ export default {
fontFaces,
staticStyles,
icons,
- animations,
} as ThemeInput