From c33ca9fa9ed775c0966c70e982cf3ce7eee26ce7 Mon Sep 17 00:00:00 2001 From: sameh doush <48515888+samehdoush@users.noreply.github.com> Date: Fri, 9 Dec 2022 15:39:21 +0300 Subject: [PATCH] add height option --- readme.md | 3 +++ src/progress.js | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 22b049c..9d16c85 100644 --- a/readme.md +++ b/readme.md @@ -27,5 +27,8 @@ InertiaProgress.init({ // Whether the NProgress spinner will be shown. showSpinner: false, + + // The height of the progress bar. + height : '2px', }) ``` diff --git a/src/progress.js b/src/progress.js index 8bda399..daf90ab 100644 --- a/src/progress.js +++ b/src/progress.js @@ -32,7 +32,7 @@ function finish(event) { } } -function injectCSS(color) { +function injectCSS(color,height) { const element = document.createElement('style') element.type = 'text/css' element.textContent = ` @@ -49,7 +49,7 @@ function injectCSS(color) { left: 0; width: 100%; - height: 2px; + height: ${height}; } #nprogress .peg { @@ -111,11 +111,11 @@ function injectCSS(color) { } const Progress = { - init({ delay = 250, color = '#29d', includeCSS = true, showSpinner = false } = {}) { + init({ delay = 250, color = '#29d', includeCSS = true, showSpinner = false ,height = '2px'} = {}) { addEventListeners(delay) NProgress.configure({ showSpinner }) if (includeCSS) { - injectCSS(color) + injectCSS(color,height) } }, }