202508261100

手機點歌 版面
This commit is contained in:
allen.yan 2025-08-26 11:25:53 +08:00
parent a936ed1c7c
commit 25780ceb15
4 changed files with 103 additions and 134 deletions

View File

@ -0,0 +1,34 @@
<?php
namespace App\Livewire\Layout;
use Livewire\Component;
use App\Livewire\Actions\Logout;
class Navigation extends Component
{
// 菜單列表
public array $menus = [
['name' => '首頁', 'route' => 'welcome'],
['name' => '新歌快報', 'route' => 'new-songs'],
['name' => '熱門排行', 'route' => 'top-ranking'],
['name' => '歌星查詢', 'route' => 'search-singer'],
['name' => '歌名查詢', 'route' => 'search-song'],
['name' => '已點歌曲', 'route' => 'clicked-song'],
['name' => '聲音控制', 'route' => 'sound-control'],
['name' => '社群媒體', 'route' => 'social-media'],
['name' => '真情告白', 'route' => 'love-message'],
['name' => '心情貼圖', 'route' => 'mood-stickers'],
];
public function logout(Logout $logout)
{
$logout();
return redirect('/');
}
public function render()
{
return view('livewire.layout.navigation');
}
}

View File

@ -1,3 +1,21 @@
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
body { font-family: 'Roboto', sans-serif; margin: 0; padding: 0; background-color: #f4f4f4; }
.container { text-align: center; margin: 20px; }
.header { background: #D32F2F; padding: 10px 0; color: white; font-size: 24px; font-weight: 500; text-align: center; }
.banner { width: 100%; max-width: 600px; margin: 0 auto 20px; }
.banner img { width: 100%; height: auto; }
.content { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px 20px; max-width: 600px; margin: 0 auto; justify-content: center; }
@media (max-width: 600px) { .content { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
@media (max-width: 400px) { .content { grid-template-columns: repeat(2, 1fr); gap: 8px; } .card { width: auto; max-width: 160px; } }
.card { width: 100%; max-width: 180px; margin: 0 auto; display: flex; justify-content: center; align-items: center;
background: linear-gradient(135deg, #FF4081, #FF4081); color: white; border-radius: 10px; text-align: center;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); overflow: hidden; cursor: pointer; }
.card:hover { transform: scale(1.05); }
.card img { width: 100%; height: auto; object-fit: contain; }
.section { display: none; }
.section.active { display: block; }

View File

@ -1,36 +1,37 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title> <title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts --> <!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net"> <link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" /> <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
<!-- Scripts --> <!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js']) @vite(['resources/css/app.css', 'resources/js/app.js'])
</head> @livewireStyles
<body class="font-sans antialiased"> @wireUiScripts
<div class="min-h-screen bg-gray-100"> </head>
<livewire:layout.navigation /> <body class="font-sans antialiased bg-gray-100">
<livewire:layout.navigation />
<!-- Page Heading --> <div class="min-h-screen">
@if (isset($header)) <!-- Page Heading -->
<header class="bg-white shadow"> @if (isset($header))
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8"> <header class="bg-white shadow">
{{ $header }} {{ $header }}
</div> </header>
</header> @endif
@endif
<!-- Page Content --> <!-- Page Content -->
<main> <main>
{{ $slot }} {{ $slot }}
</main> </main>
</div> </div>
</body> @livewireScripts
</body>
</html> </html>

View File

@ -1,110 +1,26 @@
<?php <div x-data="{ open: false }" @click.outside="open = false" class="relative">
<!-- Menu Toggle -->
<button class="absolute top-2.5 left-2.5 cursor-pointer" @click="open = !open" aria-label="Toggle Menu">
<x-icon name="bars-3" solid class="w-9 h-9 text-gray-700" />
</button>
use App\Livewire\Actions\Logout; <!-- Navigation Menu -->
use Livewire\Volt\Component; <nav
class="fixed top-0 left-0 h-full w-64 bg-white shadow-lg transform -translate-x-full transition-transform duration-300 ease-in-out z-50"
:class="{ 'translate-x-0': open }"
>
<div class="divide-y">
@guest
<x-button flat class="w-full justify-start px-4 py-3" :href="route('login')" label="Log in / Register" />
@endguest
new class extends Component @foreach($menus as $menu)
{ <x-button flat class="w-full justify-start px-4 py-3" :href="route($menu['route'])" label="{{ $menu['name'] }}" />
/** @endforeach
* Log the current user out of the application.
*/
public function logout(Logout $logout): void
{
$logout();
$this->redirect('/', navigate: true); @auth
} <x-button flat class="w-full justify-start px-4 py-3 text-red-600" label="登出" wire:click="logout" />
}; ?> @endauth
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
<!-- Primary Navigation Menu -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ route('dashboard') }}" wire:navigate>
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" />
</a>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
{{ __('Dashboard') }}
</x-nav-link>
</div>
</div>
<!-- Settings Dropdown -->
<div class="hidden sm:flex sm:items-center sm:ms-6">
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150">
<div x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
<div class="ms-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</div>
</button>
</x-slot>
<x-slot name="content">
<x-dropdown-link :href="route('profile')" wire:navigate>
{{ __('Profile') }}
</x-dropdown-link>
<!-- Authentication -->
<button wire:click="logout" class="w-full text-start">
<x-dropdown-link>
{{ __('Log Out') }}
</x-dropdown-link>
</button>
</x-slot>
</x-dropdown>
</div>
<!-- Hamburger -->
<div class="-me-2 flex items-center sm:hidden">
<button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div> </div>
</div> </nav>
</div>
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200">
<div class="px-4">
<div class="font-medium text-base text-gray-800" x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
<div class="font-medium text-sm text-gray-500">{{ auth()->user()->email }}</div>
</div>
<div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile')" wire:navigate>
{{ __('Profile') }}
</x-responsive-nav-link>
<!-- Authentication -->
<button wire:click="logout" class="w-full text-start">
<x-responsive-nav-link>
{{ __('Log Out') }}
</x-responsive-nav-link>
</button>
</div>
</div>
</div>
</nav>