From 1a30b346e812926f606e09048c204bfed169b58e Mon Sep 17 00:00:00 2001 From: myxvisual Date: Thu, 3 Aug 2017 19:43:12 +0800 Subject: [PATCH] feat: Add ProgressRing support css-in-js --- src/ProgressRing/index.tsx | 74 +++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/src/ProgressRing/index.tsx b/src/ProgressRing/index.tsx index 98c7791c..6b07f0e1 100644 --- a/src/ProgressRing/index.tsx +++ b/src/ProgressRing/index.tsx @@ -41,7 +41,7 @@ export class ProgressRing extends React.Component { return `react-uwp-progress-ring_${dotsNumber}_${speed}`; } - getInnerCSS = (className?: string) => { + getCSSText = (className?: string) => { const { dotsNumber, speed } = this.props; return ( `.${className} { @@ -99,42 +99,32 @@ ${vendorPrefixes.map(str => `@${str}keyframes CircleLoopFade { speed, dotsStyle, style, + className, ...attributes } = this.props; - const dotsSize = size / 12; const { theme } = this.context; - const className = this.getOnlyClassName(); + const onlyClassName = this.getOnlyClassName(); + theme.styleManager.addCSSTextWithUpdate(this.getCSSText(onlyClassName)); + + const inlineStyles = getStyles(this); + const styles = theme.prepareStyles({ + className: "progress-ring", + styles: inlineStyles + }); + return (
-