Compare commits

..

1 Commits

Author SHA1 Message Date
12aaf8e737 fix: animates episode toggle list button 2025-06-19 14:49:58 -05:00
3 changed files with 26 additions and 4 deletions

View File

@@ -18,11 +18,12 @@ export default class extends Controller {
active: Boolean, active: Boolean,
}; };
static targets = ['list', 'count', 'episodeSelector'] static targets = ['list', 'count', 'episodeSelector', 'toggleButton']
static outlets = ['loading-icon'] static outlets = ['loading-icon']
options = [] options = []
optionsLoaded = false optionsLoaded = false
isOpen = false
async connect() { async connect() {
await this.setOptions(); await this.setOptions();
@@ -79,7 +80,16 @@ export default class extends Controller {
} }
toggleList() { toggleList() {
// if (!this.isOpen) {
// this.toggleButtonTarget.classList.add('rotate-180');
// this.toggleButtonTarget.classList.remove('-rotate-180');
// } else {
// this.toggleButtonTarget.classList.add('-rotate-180');
// this.toggleButtonTarget.classList.remove('rotate-180');
// }
this.listTarget.classList.toggle('hidden'); this.listTarget.classList.toggle('hidden');
this.toggleButtonTarget.classList.toggle('rotate-90');
this.toggleButtonTarget.classList.toggle('-rotate-90');
} }
download() { download() {

View File

@@ -14,6 +14,8 @@ module.exports = {
"bg-blue-600", "bg-blue-600",
"bg-rose-600", "bg-rose-600",
"min-w-64", "min-w-64",
"rotate-180",
"-rotate-180",
"transition-opacity", "transition-opacity",
"ease-in", "ease-in",
"duration-700", "duration-700",

View File

@@ -58,10 +58,20 @@
{{ stimulus_target('tv-results', 'episodeSelector') }} {{ stimulus_target('tv-results', 'episodeSelector') }}
/> />
</div> </div>
<button class="flex flex-col items-end" <button class="flex flex-col items-end transition-transform duration-300 ease-in-out rotate-90"
{{ stimulus_target('tv-results', 'toggleButton') }}
{{ stimulus_action('tv-results', 'toggleList', 'click') }}> {{ stimulus_action('tv-results', 'toggleList', 'click') }}>
<svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 32 32"> {# <svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 32 32">#}
<path fill="currentColor" d="m16 10l10 10l-1.4 1.4l-8.6-8.6l-8.6 8.6L6 20z"/> {# <path fill="currentColor" d="m16 10l10 10l-1.4 1.4l-8.6-8.6l-8.6 8.6L6 20z"/>#}
{# </svg>#}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32">
<path
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M20 6L10 16l10 10" />
</svg> </svg>
</button> </button>
</div> </div>