Skip to content

Commit

Permalink
Merge pull request #32 from ProchaLu/add-template
Browse files Browse the repository at this point in the history
Implement template option
  • Loading branch information
TheSGJ authored Oct 16, 2023
2 parents 0f90d94 + 5a240e0 commit e93bba6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export type NextTopLoaderProps = {
*/
shadow?: string | false;
/**
* Defines a template for the TopLoader.
* @default "<div class="bar" role="bar"><div class="peg"></div></div>
* <div class="spinner" role="spinner"><div class="spinner-icon"></div></div>"
*/
template?: string;
/**
* Defines zIndex for the TopLoader.
* @default 1600
*
Expand All @@ -78,6 +84,7 @@ const NextTopLoader = ({
easing,
speed,
shadow,
template,
zIndex = 1600,
}: NextTopLoaderProps) => {
const defaultColor = '#29d';
Expand Down Expand Up @@ -108,6 +115,9 @@ const NextTopLoader = ({
minimum: initialPosition ?? 0.08,
easing: easing ?? 'ease',
speed: speed ?? 200,
template:
template ??
'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>',
});

function isAnchorOfCurrentUrl(currentUrl: string, newUrl: string) {
Expand Down Expand Up @@ -199,6 +209,7 @@ NextTopLoader.propTypes = {
initialPosition: PropTypes.number,
easing: PropTypes.string,
speed: PropTypes.number,
template: PropTypes.string,
shadow: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
zIndex: PropTypes.number,
};

0 comments on commit e93bba6

Please sign in to comment.