Skip to content

Commit 8e86866

Browse files
committed
Added theme system (Tailwind default + Bootstrap; configurable via config)
1 parent a709f80 commit 8e86866

File tree

2 files changed

+77
-18
lines changed

2 files changed

+77
-18
lines changed

CHANGELOG.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
## [Unreleased]
1212

1313
### Added
14-
- Configuration documentation for each option in `config/media-uploader.php`, including environment variable overrides, presets (types, mimes, max_kb), and collection → preset mapping.
15-
- Guidance for creating and registering custom themes:
16-
- Create a new folder under `themes`, e.g. `custom`.
17-
- Copy the existing `media-uploader` theme file from `tailwind` or `bootstrap` into the new `custom` folder (do not change the file name).
18-
- Edit the copied file as desired.
19-
- Register it in the `themes` config array, for example: `'custom' => 'media-uploader::themes.custom.media-uploader'`.
20-
- Use it globally via `.env` (`MEDIA_UPLOADER_THEME=custom`) or per instance:
21-
<livewire:media-uploader
22-
:for="$post"
23-
collection="images"
24-
theme="custom"
25-
/>
14+
2615

2716
### Changed
28-
- Clarified the behavior of `accept_from_config` and how the `accept` attribute is derived from the active preset.
2917

3018
### Fixed
3119

3220

3321
---
22+
## [v0.2.0] — 2025-09-01
23+
24+
### Added
25+
- **Theme system** with **Tailwind (default)** and **Bootstrap** themes.
26+
- **Custom themes** support:
27+
1. Create a new folder under `resources/views/vendor/media-uploader/themes`, e.g. `custom/`.
28+
2. Copy `media-uploader.blade.php` from `tailwind/` or `bootstrap/` into `custom/` (keep the filename).
29+
3. Register in config:
30+
```php
31+
'themes' => [
32+
'tailwind' => 'media-uploader::themes.tailwind.media-uploader',
33+
'bootstrap' => 'media-uploader::themes.bootstrap.media-uploader',
34+
'custom' => 'media-uploader::themes.custom.media-uploader',
35+
],
36+
'theme' => 'custom', // to make it default
37+
```
38+
4. Or set per-instance:
39+
```html
40+
<livewire:media-uploader :for="$post" collection="images" theme="custom" />
41+
```
42+
- Configuration docs for each option in `config/media-uploader.php`, including **ENV overrides**, presets (`types`, `mimes`, `max_kb`), and **collection → preset** mapping.
43+
44+
### Changed
45+
- Default view now resolves via the **theme map** (Tailwind by default).
46+
Existing installs continue to render with Tailwind unless you switch themes.
47+
48+
### Compatibility
49+
- **No breaking changes.** Defaults preserve prior behavior.
50+
- If you previously published the old (pre-theme) Blade, it will keep working if you’ve retained the legacy alias. If you want to use the new theme system, publish/move your override to `themes/<your-theme>/media-uploader.blade.php`.
51+
52+
### Migration Notes (only if you customized the old path)
53+
- Minor migration required for users who published the old view (move file to the themed path).
54+
- Move your customized Blade from:
55+
```html
56+
resources/views/vendor/media-uploader/livewire/media-uploader.blade.php
57+
```
58+
to:
59+
```html
60+
resources/views/vendor/media-uploader/themes/tailwind/media-uploader.blade.php
61+
```
62+
(or into your custom theme folder), and register that theme in the config.
3463

3564
## [v0.1.0] — 2025-08-30
3665
### Added

README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Livewire Media Uploader
22

3-
Livewire Media Uploader is a reusable Livewire v3 component that integrates seamlessly with Spatie Laravel Media Library. It ships a clean Tailwind Blade view (fully publishable), Alpine overlays for previews and confirmations, drag-and-drop uploads, per-file metadata (caption/description/order), configurable presets, name-conflict strategies, and optional SHA-256 duplicate detection. Drop it in, point it at a model, and you’re shipping in minutes.
3+
Livewire Media Uploader is a reusable Livewire v3 component that integrates seamlessly with Spatie Laravel Media Library. It ships a clean Tailwind Blade view by default (fully publishable), Bootstrap theme as an option, Alpine overlays for previews/confirmations, drag-and-drop uploads, per-file metadata (caption/description/order), configurable presets, name-conflict strategies, and optional SHA-256 duplicate detection. Drop it in, point it at a model, and you’re shipping in minutes.
44

55
---
66

@@ -25,7 +25,10 @@ Livewire Media Uploader is a reusable Livewire v3 component that integrates seam
2525

2626
## Features
2727

28-
- ✅ Livewire v3 component with Tailwind-only Blade (no UI dependency)
28+
- ✅ Livewire v3 component with themeable Blade UI
29+
- Tailwind (default)
30+
- Bootstrap (optional)
31+
- Fully publishable and overridable
2932
- ✅ Spatie Media Library integration (attach, list, edit meta, delete)
3033
-**Publishable view** for per-project customization
3134
- ✅ Drag & drop uploads + progress bar
@@ -50,6 +53,9 @@ Livewire Media Uploader is a reusable Livewire v3 component that integrates seam
5053
- spatie/laravel-medialibrary **^10.12**
5154
- TailwindCSS (optional but recommended for the default view)
5255
- Alpine.js (used by overlays/progress; see [Overlays & UX Notes](#overlays--ux-notes))
56+
- CSS depending on theme:
57+
- Tailwind theme → TailwindCSS (recommended)
58+
- Bootstrap theme → Bootstrap CSS (no Bootstrap JS required; Alpine drives modals)
5359

5460
---
5561

@@ -90,10 +96,34 @@ php artisan vendor:publish --tag=media-uploader-views
9096

9197
After publishing, customize the Blade at:
9298
```html
93-
resources/views/vendor/media-uploader/livewire/media-uploader.blade.php
99+
resources/views/vendor/media-uploader/themes/tailwind/media-uploader.blade.php
100+
resources/views/vendor/media-uploader/themes/bootstrap/media-uploader.blade.php
94101
```
95-
96-
102+
## Theme System (Tailwind + Bootstrap + custom)
103+
Select the theme in config/media-uploader.php:
104+
```php
105+
// config/media-uploader.php
106+
return [
107+
'theme' => 'tailwind', // 'tailwind' (default) or 'bootstrap'
108+
'themes' => [
109+
'tailwind' => 'media-uploader::themes.tailwind.media-uploader',
110+
'bootstrap' => 'media-uploader::themes.bootstrap.media-uploader',
111+
],
112+
// ...
113+
];
114+
```
115+
### Custom themes
116+
- Copy an existing theme directory (e.g. themes/tailwind) to themes/custom and edit the Blade.
117+
- Register it in the map and select it:
118+
```php
119+
'theme' => 'custom',
120+
'themes' => [
121+
'tailwind' => 'media-uploader::themes.tailwind.media-uploader',
122+
'bootstrap' => 'media-uploader::themes.bootstrap.media-uploader',
123+
'custom' => 'media-uploader::themes.custom.media-uploader',
124+
],
125+
```
126+
> Note: The component’s Livewire + Alpine behavior is identical across themes. Only classes/markup differ. If you use the Bootstrap theme, make sure your layout includes Bootstrap CSS.
97127
## Environment variables (optional)
98128
You can override preset limits and accepted types/mimes via .env. These map directly to config/media-uploader.php:
99129

0 commit comments

Comments
 (0)