diff --git a/src/SpinnerCircular.tsx b/src/SpinnerCircular.tsx index e5efb91a..55267d96 100644 --- a/src/SpinnerCircular.tsx +++ b/src/SpinnerCircular.tsx @@ -7,10 +7,10 @@ import './SpinnerCircular.css'; export type SpinnerCircularProps = SpinnersProps & SecondaryColorSpinnerProps; const Component = ({ - secondaryColor, - speed, - still, - thickness, + secondaryColor = secondaryColorDefaultProps.secondaryColor, + speed = secondaryColorDefaultProps.speed, + still = secondaryColorDefaultProps.still, + thickness = secondaryColorDefaultProps.thickness, ...svgProps }: SecondaryColorSpinnerProps) => { const strokeWidth = 4 * (thickness / 100); @@ -44,6 +44,4 @@ const Component = ({ ); }; -Component.defaultProps = secondaryColorDefaultProps; - export const SpinnerCircular = withSharedProps(Component); diff --git a/src/SpinnerCircularFixed.tsx b/src/SpinnerCircularFixed.tsx index 14f8f679..90ce72b9 100644 --- a/src/SpinnerCircularFixed.tsx +++ b/src/SpinnerCircularFixed.tsx @@ -7,10 +7,10 @@ import './SpinnerCircularFixed.css'; export type SpinnerCircularFixedProps = SpinnersProps & SecondaryColorSpinnerProps; const Component = ({ - secondaryColor, - speed, - still, - thickness, + secondaryColor = secondaryColorDefaultProps.secondaryColor, + speed = secondaryColorDefaultProps.speed, + still = secondaryColorDefaultProps.still, + thickness = secondaryColorDefaultProps.thickness, ...svgProps }: SecondaryColorSpinnerProps) => { const strokeWidth = 4 * (thickness / 100); @@ -44,6 +44,4 @@ const Component = ({ ); }; -Component.defaultProps = secondaryColorDefaultProps; - export const SpinnerCircularFixed = withSharedProps(Component); diff --git a/src/SpinnerCircularSplit.tsx b/src/SpinnerCircularSplit.tsx index e652206c..e381459a 100644 --- a/src/SpinnerCircularSplit.tsx +++ b/src/SpinnerCircularSplit.tsx @@ -7,10 +7,10 @@ import './SpinnerCircularSplit.css'; export type SpinnerCircularSplitProps = SpinnersProps & SecondaryColorSpinnerProps; const Component = ({ - secondaryColor, - speed, - still, - thickness, + secondaryColor = secondaryColorDefaultProps.secondaryColor, + speed = secondaryColorDefaultProps.speed, + still = secondaryColorDefaultProps.still, + thickness = secondaryColorDefaultProps.thickness, ...svgProps }: SecondaryColorSpinnerProps) => { const strokeWidth = 4 * (thickness / 100); @@ -45,6 +45,4 @@ const Component = ({ ); }; -Component.defaultProps = secondaryColorDefaultProps; - export const SpinnerCircularSplit = withSharedProps(Component); diff --git a/src/SpinnerDiamond.tsx b/src/SpinnerDiamond.tsx index 572df194..ab457926 100644 --- a/src/SpinnerDiamond.tsx +++ b/src/SpinnerDiamond.tsx @@ -36,10 +36,10 @@ const coords = [ export type SpinnerDiamondProps = SpinnersProps & SecondaryColorSpinnerProps; const Component = ({ - secondaryColor, - speed, - still, - thickness, + secondaryColor = secondaryColorDefaultProps.secondaryColor, + speed = secondaryColorDefaultProps.speed, + still = secondaryColorDefaultProps.still, + thickness = secondaryColorDefaultProps.thickness, ...svgProps }: SecondaryColorSpinnerProps) => { const diamondStyle: CSSProperties = { @@ -62,7 +62,5 @@ const Component = ({ ); }; -Component.defaultProps = secondaryColorDefaultProps; - export const SpinnerRomb = withSharedProps(Component); export const SpinnerDiamond = withSharedProps(Component); diff --git a/src/SpinnerDotted.tsx b/src/SpinnerDotted.tsx index e43f1c32..6a4bad60 100644 --- a/src/SpinnerDotted.tsx +++ b/src/SpinnerDotted.tsx @@ -18,9 +18,9 @@ const coords = [ export type SpinnerDottedProps = SpinnersProps & SpinnerProps; export const Component = ({ - speed, - still, - thickness, + speed = defaultProps.speed, + still = defaultProps.still, + thickness = defaultProps.thickness, ...svgProps }: SpinnerProps) => { const duration = 200 / speed; @@ -60,6 +60,4 @@ export const Component = ({ ); }; -Component.defaultProps = defaultProps; - export const SpinnerDotted = withSharedProps(Component); diff --git a/src/SpinnerInfinity.tsx b/src/SpinnerInfinity.tsx index da3bfcfa..9916b70c 100644 --- a/src/SpinnerInfinity.tsx +++ b/src/SpinnerInfinity.tsx @@ -7,10 +7,10 @@ import './SpinnerInfinity.css'; export type SpinnerInfinityProps = SpinnersProps & SecondaryColorSpinnerProps; const Component = ({ - secondaryColor, - speed, - still, - thickness, + secondaryColor = secondaryColorDefaultProps.secondaryColor, + speed = secondaryColorDefaultProps.speed, + still = secondaryColorDefaultProps.still, + thickness = secondaryColorDefaultProps.thickness, ...svgProps }: SecondaryColorSpinnerProps) => { const strokeWidth = 7 * (thickness / 100); @@ -41,6 +41,4 @@ const Component = ({ ); }; -Component.defaultProps = secondaryColorDefaultProps; - export const SpinnerInfinity = withSharedProps(Component); diff --git a/src/SpinnerRound.tsx b/src/SpinnerRound.tsx index 05ac2403..f9ff7cc8 100644 --- a/src/SpinnerRound.tsx +++ b/src/SpinnerRound.tsx @@ -7,9 +7,9 @@ import './SpinnerRound.css'; export type SpinnerRoundProps = SpinnersProps & SpinnerProps; const Component = ({ - speed, - still, - thickness, + speed = defaultProps.speed, + still = defaultProps.still, + thickness = defaultProps.thickness, ...svgProps }: SpinnerProps) => { const strokeWidth = 3 * (thickness / 100); @@ -35,6 +35,4 @@ const Component = ({ ); }; -Component.defaultProps = defaultProps; - export const SpinnerRound = withSharedProps(Component); diff --git a/src/SpinnerRoundFilled.tsx b/src/SpinnerRoundFilled.tsx index a865f562..2d34b8b7 100644 --- a/src/SpinnerRoundFilled.tsx +++ b/src/SpinnerRoundFilled.tsx @@ -23,9 +23,9 @@ const animations = [ export type SpinnerRoundFilledProps = SpinnersProps & SpinnerProps; const Component = ({ - speed, - still, - thickness, + speed = defaultProps.speed, + still = defaultProps.still, + thickness = defaultProps.thickness, ...svgProps }: SpinnerProps) => ( @@ -48,6 +48,4 @@ const Component = ({ ); -Component.defaultProps = defaultProps; - export const SpinnerRoundFilled = withSharedProps(Component); diff --git a/src/SpinnerRoundOutlined.tsx b/src/SpinnerRoundOutlined.tsx index fc871358..5b369050 100644 --- a/src/SpinnerRoundOutlined.tsx +++ b/src/SpinnerRoundOutlined.tsx @@ -21,9 +21,9 @@ const animations = [ export type SpinnerRoundOutlinedProps = SpinnersProps & SpinnerProps; const Component = ({ - speed, - still, - thickness, + speed = defaultProps.speed, + still = defaultProps.still, + thickness = defaultProps.thickness, ...svgProps }: SpinnerProps) => { const strokeWidth = 3 * (thickness / 100); @@ -48,6 +48,4 @@ const Component = ({ ); }; -Component.defaultProps = defaultProps; - export const SpinnerRoundOutlined = withSharedProps(Component); diff --git a/src/withSharedProps.tsx b/src/withSharedProps.tsx index 3d4588fa..f14a61f0 100644 --- a/src/withSharedProps.tsx +++ b/src/withSharedProps.tsx @@ -17,7 +17,11 @@ export type SpinnersProps = Partial; export const withSharedProps =

(Component: ComponentType

) => { const Wrapper = (props: P) => { const { - color, enabled, size, style, ...otherProps + color = defaultProps.color, + enabled = defaultProps.enabled, + size = defaultProps.size, + style = defaultProps.style, + ...otherProps } = props; const componentProps = { ...otherProps, @@ -34,7 +38,5 @@ export const withSharedProps =

(Component: ComponentTyp return ; }; - Wrapper.defaultProps = defaultProps; - return Wrapper; };