Skip to content

Commit

Permalink
Create sidebar (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhae-de authored Nov 4, 2019
1 parent 5db5cd0 commit 4622c1d
Show file tree
Hide file tree
Showing 23 changed files with 3,078 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/.idea
/node_modules
/vendor
.DS_Store
.phpunit.result.cache
auth.json
composer.phar
composer.lock
package-lock.json
phpunit.xml
Thumbs.db
yarn.lock
87 changes: 86 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,86 @@
# laravel-nova-collapsible-sidebar
# Laravel Nova Collapsible Sidebar

![Packagist](https://img.shields.io/packagist/l/pos-lifestyle/laravel-nova-collapsible-sidebar)
![Packagist Version](https://img.shields.io/packagist/v/pos-lifestyle/laravel-nova-collapsible-sidebar)

## About

This is a collapsible sidebar for Laravel Nova 2.

## Installation

To install the sidebar run the following command in your Laravel Nova project:

```bash
composer require pos-lifestyle/laravel-nova-collapsible-sidebar
```

## Usage

Copy the Laravel Nova layout template `vendor/laravel/nova/resources/views/layout.blade.php` to
`resources/views/vendor/nova/layout.blade.php`.

```bash
mkdir -p resources/views/vendor/nova
cp -r vendor/laravel/nova/resources/views/layout.blade.php resources/views/vendor/nova/layout.blade.php
```

In `resources/views/vendor/nova/layout.blade.php` you will find the sidebar which looks like this:

```html
<!-- Sidebar -->
<div class="min-h-screen flex-none pt-header min-h-screen w-sidebar bg-grad-sidebar px-6">
<a href="{{ \Laravel\Nova\Nova::path() }}">
<div class="absolute pin-t pin-l pin-r bg-logo flex items-center w-sidebar h-header px-6 text-white">
@include('nova::partials.logo')
</div>
</a>

@foreach (\Laravel\Nova\Nova::availableTools(request()) as $tool)
{!! $tool->renderNavigation() !!}
@endforeach
</div>
```

Replace the ordinary `div` tag by `collapsible-sidebar`:

```html
<collapsible-sidebar class="min-h-screen flex-none pt-header min-h-screen w-sidebar bg-grad-sidebar px-6">
...
</collapsible-sidebar>
```

Now you can toggle the sidebar by clicking the icon on the top right of the sidebar. The sidebar automatically expands
when you move the mouse pointer over the sidebar.

## Configuration

To save the state, add `persist` to the `collapsible-sidebar` tag.

```html
<collapsible-sidebar class="..." persist>
...
</collapsible-sidebar>
```

To show the trigger only when you move the mouse pointer over the sidebar, add `shy-trigger` to the
`collapsible-sidebar` tag.

```html
<collapsible-sidebar class="..." shy-trigger>
...
</collapsible-sidebar>
```

## Screenshots

<table>
<tr>
<td><strong>Expanded</strong></td>
<td><strong>Collapsed</strong></td>
</tr>
<tr>
<td><img src="docs/assets/img/collapsible-sidebar-expanded.png" alt="Collapsible sidebar (expanded)"></td>
<td><img src="docs/assets/img/collapsible-sidebar-collapsed.png" alt="Collapsible sidebar (collapsed)"></td>
</tr>
</table>
54 changes: 54 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "pos-lifestyle/laravel-nova-collapsible-sidebar",
"description": "A Laravel Nova collapsible sidebar.",
"keywords": [
"laravel",
"nova",
"sidebar",
"navigation",
"collapsible"
],
"license": "MIT",
"authors": [
{
"name": "Jan Hähne",
"email": "[email protected]",
"homepage": "https://github.com/jhae-de",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/pos-lifestyle/laravel-nova-collapsible-sidebar/issues"
},
"repositories": [
{
"type": "composer",
"url": "https://nova.laravel.com"
}
],
"require": {
"php": "^7.1",
"laravel/framework": "^5.8 || ^6.0",
"laravel/nova": "^2.0"
},
"require-dev": {
"roave/security-advisories": "dev-master"
},
"autoload": {
"psr-4": {
"PosLifestyle\\CollapsibleSidebar\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"PosLifestyle\\CollapsibleSidebar\\ToolServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
5 changes: 5 additions & 0 deletions dist/css/collapsible-sidebar.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/css/collapsible-sidebar.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
2,671 changes: 2,671 additions & 0 deletions dist/fonts/vendor/font-awesome/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions dist/js/collapsible-sidebar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/js/collapsible-sidebar.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"/js/collapsible-sidebar.js": "/js/collapsible-sidebar.js?id=92e333d35670599afb04",
"/css/collapsible-sidebar.css": "/css/collapsible-sidebar.css?id=ee37005613840405cbfa",
"/js/collapsible-sidebar.js.map": "/js/collapsible-sidebar.js.map?id=499e883bb9bf0903dd23",
"/css/collapsible-sidebar.css.map": "/css/collapsible-sidebar.css.map?id=ff2102fd11ebe5f7c39b"
}
Binary file added docs/assets/img/collapsible-sidebar-collapsed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/img/collapsible-sidebar-expanded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4622c1d

Please sign in to comment.