Skip to content

Commit

Permalink
Merge pull request #113 from alexmanase/use-livewire-3
Browse files Browse the repository at this point in the history
Update to Livewire 3
  • Loading branch information
freekmurze authored Oct 3, 2023
2 parents 211c6b8 + 258090e commit 514810a
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 35 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,12 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.1, 8.0, 7.4]
laravel: [8.*, 9.*, 10.*]
php: [8.1, 8.2]
laravel: [10.*]
dependency-version: [prefer-lowest, prefer-stable]
exclude:
- laravel: 10.*
php: 8.0
- laravel: 10.*
php: 7.4
- laravel: 9.*
php: 7.4
include:
- laravel: 10.*
testbench: ^8.0
- laravel: 8.*
testbench: ^6.23
- laravel: 9.*
testbench: ^7.0

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": "^7.4|^8.0",
"illuminate/database": "^8.0|^9.0|^10.0",
"illuminate/view": "^8.0|^9.0|^10.0",
"livewire/livewire": "^2.0",
"livewire/livewire": "^3.0",
"spatie/sun": "^1.1.1"
},
"require-dev": {
Expand Down Expand Up @@ -57,4 +57,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
2 changes: 1 addition & 1 deletion config/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
'stylesheets' => [
'inter' => 'https://rsms.me/inter/inter.css',
],
];
];
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

namespace Spatie\Dashboard\Http\Components;
namespace Spatie\Dashboard\Components;

use Illuminate\Support\HtmlString;
use Illuminate\View\Component;
use Spatie\Dashboard\Dashboard;

class DashboardComponent extends Component
{
public string $theme;
public string $theme = '';

public string $initialMode;
public string $initialMode = '';

public HtmlString $assets;
public ?HtmlString $assets = null;

public function __construct(Dashboard $dashboard)
public function mount(Dashboard $dashboard)
{
$this->theme = $dashboard->getTheme();

Expand All @@ -27,4 +27,4 @@ public function render()
{
return view('dashboard::dashboard');
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Spatie\Dashboard\Http\Components;
namespace Spatie\Dashboard\Components;

use Illuminate\View\Component;

Expand Down Expand Up @@ -72,4 +72,4 @@ private function indexInAlphabet(string $character): int

return $index + 1;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Spatie\Dashboard\Http\Components;
namespace Spatie\Dashboard\Components;

use Livewire\Component;
use Spatie\Dashboard\Dashboard;
Expand All @@ -12,8 +12,8 @@ public function render()
/** @var \Spatie\Dashboard\Dashboard $dashboard */
$dashboard = app(Dashboard::class);

$this->emit('updateMode', $dashboard->getMode());
$this->dispatch('updateMode', $dashboard->getMode());

return view('dashboard::components.updateMode');
}
}
}
8 changes: 4 additions & 4 deletions src/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public function assets(): HtmlString
}

foreach ($this->inlineScripts as $inlineScript) {
$assets[] = "<script>{$inlineScript}</script>";
$assets[] = "<script>$inlineScript</script>";
}

foreach ($this->stylesheets as $stylesheet) {
$assets[] = "<link rel=\"stylesheet\" href=\"{$stylesheet}\">";
$assets[] = "<link rel=\"stylesheet\" href=\"$stylesheet\">";
}

foreach ($this->inlineStylesheets as $inlineStylesheet) {
$assets[] = "<style>{$inlineStylesheet}</style>";
$assets[] = "<style>$inlineStylesheet</style>";
}

return new HtmlString(implode('', $assets));
Expand Down Expand Up @@ -98,4 +98,4 @@ protected function isValidTheme(string $theme): bool
{
return in_array($theme, self::THEMES);
}
}
}
8 changes: 4 additions & 4 deletions src/DashboardServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Livewire\Livewire;
use Spatie\Dashboard\Http\Components\DashboardComponent;
use Spatie\Dashboard\Http\Components\DashboardTileComponent;
use Spatie\Dashboard\Http\Components\UpdateModeComponent;
use Spatie\Dashboard\Components\DashboardComponent;
use Spatie\Dashboard\Components\DashboardTileComponent;
use Spatie\Dashboard\Components\UpdateModeComponent;
use Spatie\Sun\Sun;

class DashboardServiceProvider extends ServiceProvider
Expand Down Expand Up @@ -86,4 +86,4 @@ protected function registerLivewireComponents(): self

return $this;
}
}
}

0 comments on commit 514810a

Please sign in to comment.