-
Notifications
You must be signed in to change notification settings - Fork 54
feat(Loader): add support for SVG animations, update in Teams theme #1097
Changes from all commits
9bd6d01
732e384
51d8c47
f8ed85c
7c21c0a
03321f9
d5af174
e4a1e35
98a49e4
e204136
b50b22d
8e6d155
4d7ddcd
8755bfe
34ff8d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { LoaderProps } from '../../../../components/Loader/Loader' | ||
import { ComponentStyleFunctionParam, ICSSInJSStyle } from '../../../types' | ||
import { LoaderVariables } from './loaderVariables' | ||
|
||
export default { | ||
indicator: ({ | ||
props: p, | ||
variables: v, | ||
}: ComponentStyleFunctionParam<LoaderProps, LoaderVariables>): ICSSInJSStyle => ({ | ||
// Reset existing styles from base theme | ||
animationName: 'none', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wish we didn't have to reset here all existing styles from the base theme, but I don't have any other proposal. The styles for the base theme seems reasonable for it's usage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, it's absolutely not funny, but I don't have a better idea now... |
||
animationDuration: 'unset', | ||
animationIterationCount: 'unset', | ||
animationTimingFunction: 'unset', | ||
borderColor: 'transparent', | ||
borderRadius: 0, | ||
borderStyle: 'none', | ||
borderWidth: 0, | ||
|
||
height: v.containerHeights[p.size], | ||
width: v.containerWidths[p.size], | ||
overflow: 'hidden', | ||
}), | ||
svg: ({ | ||
props: p, | ||
theme: t, | ||
variables: v, | ||
}: ComponentStyleFunctionParam<LoaderProps, LoaderVariables>) => { | ||
const outerAnimation: ICSSInJSStyle = { | ||
animationName: t.renderer.renderKeyframe( | ||
() => | ||
({ | ||
to: { | ||
opacity: 1, | ||
}, | ||
} as any), | ||
{}, | ||
), | ||
animationDelay: '1.5s', | ||
animationDirection: 'normal', | ||
animationDuration: '.3s', | ||
animationFillMode: 'both', | ||
animationIterationCount: '1', | ||
animationPlayState: 'running', | ||
animationTimingFunction: 'ease-out', | ||
display: 'block', | ||
overflow: 'hidden', | ||
position: 'relative', | ||
} | ||
const svgAnimation: ICSSInJSStyle = { | ||
animationName: t.renderer.renderKeyframe( | ||
() => | ||
({ | ||
to: { | ||
transform: `translate3d(0, ${v.svgTranslatePosition[p.size]}, 0)`, | ||
}, | ||
} as any), | ||
{}, | ||
), | ||
animationDelay: '0s', | ||
animationDirection: 'normal', | ||
animationDuration: '2s', | ||
animationFillMode: 'both', | ||
animationPlayState: 'running', | ||
animationTimingFunction: 'steps(60, end)', | ||
animationIterationCount: 'infinite', | ||
} | ||
|
||
return { | ||
...outerAnimation, | ||
|
||
':before': { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this works? why we have animations for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this because of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idea with I'm opened for better idea... |
||
...svgAnimation, | ||
|
||
backgroundImage: v.svgContent, | ||
content: '" "', | ||
display: 'block', | ||
overflow: 'hidden', | ||
|
||
height: v.svgHeights[p.size], | ||
width: v.svgWidths[p.size], | ||
}, | ||
} | ||
}, | ||
} |
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 am wondering whether the better shorthand for the svg would be the
Icon
component.. Can you elaborate why we are using theBox
here?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.
Can you please clarify why it can be
Icon
? For example, this loader is an extra big SVG:And actually, I don't see any way how spinners below can be used as icons:
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.
Make sense, I mention icon only because it is an svg