Skip to content

Commit

Permalink
refactor: use default settings for HolyLoaderProps and HolyProgressPr…
Browse files Browse the repository at this point in the history
…ops everywhere

The default settings for HolyLoaderProps and HolyProgressProps have been updated to use the DEFAULTS constant for initialPosition, easing, speed, color, height, zIndex, boxShadow, and showSpinner. This ensures consistency.
  • Loading branch information
tomcru committed Feb 29, 2024
1 parent 8098800 commit d19e96d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/HolyProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ export class HolyProgress {
*/
constructor(customSettings?: Partial<HolyProgressProps>) {
const defaultSettings: HolyProgressProps = {
initialPosition: 0.08,
easing: 'linear',
speed: 200,
initialPosition: DEFAULTS.initialPosition,
easing: DEFAULTS.easing,
speed: DEFAULTS.speed,
color: DEFAULTS.color,
height: 4,
zIndex: 2147483647,
boxShadow: undefined,
showSpinner: false,
height: DEFAULTS.height,
zIndex: DEFAULTS.zIndex,
boxShadow: DEFAULTS.boxShadow,
showSpinner: DEFAULTS.showSpinner,
};

this.settings = { ...defaultSettings, ...customSettings };
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export const DEFAULTS = {
speed: 200,
zIndex: 2147483647,
showSpinner: false,
boxShadow: undefined,
};
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const HolyLoader = ({
easing = DEFAULTS.easing,
speed = DEFAULTS.speed,
zIndex = DEFAULTS.zIndex,
boxShadow,
boxShadow = DEFAULTS.boxShadow,
showSpinner = DEFAULTS.showSpinner,
}: HolyLoaderProps): null => {
React.useEffect(() => {
Expand Down

0 comments on commit d19e96d

Please sign in to comment.