初始化
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', $board->name . ' - 论坛')
|
||||
|
||||
@section('content')
|
||||
<section class="px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
|
||||
<div class="mx-auto max-w-5xl">
|
||||
<nav class="mb-6 flex items-center gap-1.5 text-sm text-muted">
|
||||
<a href="{{ route('forum.index') }}" class="hover:text-primary">论坛</a>
|
||||
<span>/</span>
|
||||
<span class="text-fg">{{ $board->name }}</span>
|
||||
</nav>
|
||||
|
||||
<div class="mb-6 flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold tracking-tight text-fg sm:text-3xl">{{ $board->name }}</h1>
|
||||
<p class="mt-2 text-sm text-muted">{{ $board->description }}</p>
|
||||
</div>
|
||||
@auth
|
||||
<a href="#new-thread" class="inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white transition hover:bg-primary-hover">
|
||||
<x-icon name="plus" :size="16" /> 发起帖子
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ route('login') }}" class="inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-white transition hover:bg-primary-hover">
|
||||
登录后发帖
|
||||
</a>
|
||||
@endauth
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
@forelse ($threads as $thread)
|
||||
<a href="{{ route('forum.thread', $thread) }}" class="group flex items-center justify-between gap-4 rounded-lg border border-line bg-surface p-5 shadow-soft transition hover:border-primary hover:shadow-card">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-fg transition group-hover:text-primary">
|
||||
@if ($thread->is_pinned)<x-icon name="pin" :size="14" class="text-warning" /> @endif
|
||||
{{ $thread->title }}
|
||||
</h3>
|
||||
<p class="mt-1 text-xs text-muted">{{ $thread->user->name }} · {{ $thread->created_at->format('Y-m-d') }} · {{ $thread->views }} 浏览</p>
|
||||
</div>
|
||||
<span class="shrink-0 text-muted transition group-hover:text-primary">
|
||||
<x-icon name="arrow" :size="20" />
|
||||
</span>
|
||||
</a>
|
||||
@empty
|
||||
<p class="text-sm text-muted">该版块还没有帖子。</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
{{ $threads->links('pagination::bootstrap-5') }}
|
||||
</div>
|
||||
|
||||
@auth
|
||||
<div id="new-thread" class="mt-8 rounded-lg border border-line bg-surface p-6 shadow-soft sm:p-8">
|
||||
<h2 class="text-lg font-semibold text-fg">发起新帖</h2>
|
||||
<form method="POST" action="{{ route('forum.threads.store') }}" class="mt-5 space-y-5">
|
||||
@csrf
|
||||
<input type="hidden" name="board_id" value="{{ $board->id }}">
|
||||
<div>
|
||||
<label for="title" class="mb-1.5 block text-sm font-medium text-fg">标题</label>
|
||||
<input id="title" type="text" name="title" maxlength="120" required class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg placeholder:text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]">
|
||||
</div>
|
||||
<div>
|
||||
<label for="body" class="mb-1.5 block text-sm font-medium text-fg">内容</label>
|
||||
<textarea id="body" name="body" required class="w-full rounded-lg border border-line bg-surface px-3 py-2.5 text-sm text-fg placeholder:text-muted focus:border-primary focus:outline-none focus:shadow-[0_0_0_3px_var(--color-primary-soft)]"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-white transition hover:bg-primary-hover">
|
||||
<x-icon name="send" :size="18" /> 发布
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@endauth
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user