From af3955cb128bfb10a78a082bab83dd2a95136191 Mon Sep 17 00:00:00 2001 From: Kevin Qi Date: Sat, 4 May 2019 13:04:10 -0700 Subject: [PATCH] extract types into types.ts file --- src/CircularProgressbar.tsx | 39 ++++++------------------------------- src/types.ts | 32 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 33 deletions(-) create mode 100644 src/types.ts diff --git a/src/CircularProgressbar.tsx b/src/CircularProgressbar.tsx index ed7bd60..a44f199 100644 --- a/src/CircularProgressbar.tsx +++ b/src/CircularProgressbar.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { VIEWBOX_WIDTH, VIEWBOX_HEIGHT, @@ -7,39 +8,11 @@ import { VIEWBOX_CENTER_Y, } from './constants'; import Path from './Path'; - -type CircularProgressbarDefaultProps = { - strokeWidth: number; - className: string; - text: string; - background: boolean; - backgroundPadding: number; - initialAnimation: boolean; - counterClockwise: boolean; - circleRatio: number; - classes: { - root: string; - trail: string; - path: string; - text: string; - background: string; - }; - styles: { - root?: object; - trail?: object; - path?: object; - text?: object; - background?: object; - }; -}; - -type CircularProgressbarProps = CircularProgressbarDefaultProps & { - percentage: number; -}; - -type CircularProgressbarState = { - percentage: number; -}; +import { + CircularProgressbarDefaultProps, + CircularProgressbarProps, + CircularProgressbarState, +} from './types'; class CircularProgressbar extends React.Component< CircularProgressbarProps, diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..dc176ee --- /dev/null +++ b/src/types.ts @@ -0,0 +1,32 @@ +export type CircularProgressbarDefaultProps = { + strokeWidth: number; + className: string; + text: string; + background: boolean; + backgroundPadding: number; + initialAnimation: boolean; + counterClockwise: boolean; + circleRatio: number; + classes: { + root: string; + trail: string; + path: string; + text: string; + background: string; + }; + styles: { + root?: object; + trail?: object; + path?: object; + text?: object; + background?: object; + }; +}; + +export type CircularProgressbarProps = CircularProgressbarDefaultProps & { + percentage: number; +}; + +export type CircularProgressbarState = { + percentage: number; +};