Skip to content

Commit

Permalink
Reduce responsibilities since responsiveness is not the package's con…
Browse files Browse the repository at this point in the history
…cern
  • Loading branch information
Stephen Lake committed Apr 9, 2019
1 parent f55eebc commit d16785f
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 162 deletions.
Empty file modified .gitignore 100644 → 100755
Empty file.
Empty file modified README.md 100644 → 100755
Empty file.
Empty file modified composer.json 100644 → 100755
Empty file.
16 changes: 1 addition & 15 deletions config/nova-fixed-bars.php 100644 → 100755
Expand Up @@ -25,19 +25,5 @@
*/

'fixedNavbar' => true,

/*
|--------------------------------------------------------------------------
| Responsive
|--------------------------------------------------------------------------
|
| Setting this value to true will the sidebar and navigation bar responsive
| to smaller screen dimensions.
|
| Note: This only affects the sidebar and navigation bar, no other components
| will become responsive as its not the concern of this package.
|
*/

'responsive' => true,

];
4 changes: 0 additions & 4 deletions resources/css/fixed-navbar.css → resources/css/fixed-header.css 100644 → 100755
Expand Up @@ -6,15 +6,11 @@
z-index: 50;
position: fixed;
top: 0;
left: 13.75rem;
margin-top: 0;
width: 100%;
}

.content .h-header .dropdown {
margin-left: 0;
margin-right: 0;
float: right;
right: 20px;
position: fixed;
}
46 changes: 1 addition & 45 deletions resources/css/fixed-sidebar.css 100644 → 100755
@@ -1,49 +1,5 @@
.content {
margin-left: auto;
}

.w-sidebar {
z-index: 50;
position: fixed;
top: 0;
left: 0;
overflow: hidden;
}

@media (max-width: 992px) {
.w-sidebar {
z-index: 50;
position: fixed;
top: 0;
left: 0;
}

.w-sidebar.collapsed, .h-header.collapsed {
left: -14rem;
-webkit-transition: left 0.20s;
-moz-transition: left 0.20s linear;
-o-transition: left 0.20s linear;
transition: left 0.20s linear;
}

.w-sidebar, .h-header {
-webkit-transition: left 0.20s linear;
-moz-transition: left 0.20s linear;
-o-transition: left 0.20s linear;
transition: left 0.20s linear;
}

.content .h-header.collapsed {
left: 0;
}

.content {
width: 100%;
max-width: 100%;
}

.h-header i.fa.collapsed, .h-header i.fa.expanded {
display: block;
padding-right: 20px;
}
overflow: hidden;
}
File renamed without changes.
43 changes: 0 additions & 43 deletions resources/css/responsive.css

This file was deleted.

24 changes: 24 additions & 0 deletions resources/js/dynamicwidth.js
@@ -0,0 +1,24 @@
function calibrateWidths() {
const sidebar = document.querySelector('.w-sidebar')
const contentHeader = document.querySelector('.content .h-header')
const content = document.querySelector('.content')

sidebar.style = 'height: 100%'
contentHeader.style.marginLeft = 0
contentHeader.style.width = '100%'
content.style.marginLeft = `${sidebar.offsetWidth}px`
content.style.width = '100%'
content.style.maxWidth = '100%'

document
.querySelector('meta[name=viewport]')
.setAttribute('content', 'width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0')
}

document.addEventListener('DOMContentLoaded', function() {
calibrateWidths()
}, false);

window.onresize = function(event) {
calibrateWidths()
};
4 changes: 0 additions & 4 deletions resources/js/perfect-scrollbar-init.js

This file was deleted.

9 changes: 4 additions & 5 deletions resources/js/perfect-scrollbar.min.js → resources/js/perfectscrollbar.js 100644 → 100755

Large diffs are not rendered by default.

33 changes: 0 additions & 33 deletions resources/js/responsive.js

This file was deleted.

20 changes: 7 additions & 13 deletions src/NovaFixedBarsServiceProvider.php 100644 → 100755
Expand Up @@ -17,27 +17,21 @@ public function boot()
{
$config = config('nova-fixed-bars', [
'fixedSidebar' => true,
'fixedNavbar' => true,
'responsive' => true,
'fixedNavbar' => true
]);

Nova::serving(function (ServingNova $event) use ($config) {
if ($config['fixedSidebar']) {
Nova::style('nova-fixedSidebar', __DIR__.'/../resources/css/fixed-sidebar.css');

if ($config['responsive']) {
Nova::style('nova-responsive', __DIR__.'/../resources/css/responsive.css');
Nova::script('nova-responsive-js', __DIR__.'/../resources/js/responsive.js');
}

Nova::style('nova-perfect-scroll-css', __DIR__.'/../resources/css/perfect-scrollbar.css');
Nova::script('nova-perfect-scroll-js', __DIR__.'/../resources/js/perfect-scrollbar.min.js');
Nova::script('nova-perfect-scroll-js-init', __DIR__.'/../resources/js/perfect-scrollbar-init.js');
Nova::style('nova-sidebar-css', __DIR__.'/../resources/css/fixed-sidebar.css');
Nova::style('nova-ps-css', __DIR__.'/../resources/css/perfectscrollbar.css');
Nova::script('nova-ps-js', __DIR__.'/../resources/js/perfectscrollbar.js');
}

if ($config['fixedNavbar']) {
Nova::style('nova-fixedNavbar', __DIR__.'/../resources/css/fixed-navbar.css');
Nova::style('nova-fixed-header-css', __DIR__.'/../resources/css/fixed-header.css');
}

Nova::script('nova-dynamicwidth-js', __DIR__.'/../resources/js/dynamicwidth.js');
});

$this->publishes([
Expand Down

0 comments on commit d16785f

Please sign in to comment.