mirror of
https://github.com/m1ngsama/php.git
synced 2025-12-24 16:01:19 +00:00
Create layout and authentication views
Added main layout with navigation and authentication pages. Implemented responsive design using Tailwind CSS.
This commit is contained in:
parent
b081d23f88
commit
4efa2b09e3
3 changed files with 148 additions and 0 deletions
46
resources/views/auth/login.blade.php
Normal file
46
resources/views/auth/login.blade.php
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
@section('title', 'Login')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-md mx-auto bg-white rounded-lg shadow p-8">
|
||||||
|
<h1 class="text-2xl font-bold mb-6">Login</h1>
|
||||||
|
|
||||||
|
<form action="{{ route('login') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="email" class="block text-gray-700 font-bold mb-2">Email</label>
|
||||||
|
<input type="email" id="email" name="email" value="{{ old('email') }}" required
|
||||||
|
class="w-full px-3 py-2 border rounded focus:outline-none focus:border-orange-500">
|
||||||
|
@error('email')
|
||||||
|
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="password" class="block text-gray-700 font-bold mb-2">Password</label>
|
||||||
|
<input type="password" id="password" name="password" required
|
||||||
|
class="w-full px-3 py-2 border rounded focus:outline-none focus:border-orange-500">
|
||||||
|
@error('password')
|
||||||
|
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-6">
|
||||||
|
<label class="flex items-center">
|
||||||
|
<input type="checkbox" name="remember" class="mr-2">
|
||||||
|
<span class="text-gray-700">Remember me</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="w-full bg-orange-600 text-white py-2 rounded hover:bg-orange-700 font-bold">
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p class="mt-4 text-center text-gray-600">
|
||||||
|
Don't have an account? <a href="{{ route('register') }}" class="text-orange-600 hover:underline">Sign up</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
54
resources/views/auth/register.blade.php
Normal file
54
resources/views/auth/register.blade.php
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
@extends('layout')
|
||||||
|
|
||||||
|
@section('title', 'Register')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-md mx-auto bg-white rounded-lg shadow p-8">
|
||||||
|
<h1 class="text-2xl font-bold mb-6">Create Account</h1>
|
||||||
|
|
||||||
|
<form action="{{ route('register') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="name" class="block text-gray-700 font-bold mb-2">Username</label>
|
||||||
|
<input type="text" id="name" name="name" value="{{ old('name') }}" required
|
||||||
|
class="w-full px-3 py-2 border rounded focus:outline-none focus:border-orange-500">
|
||||||
|
@error('name')
|
||||||
|
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="email" class="block text-gray-700 font-bold mb-2">Email</label>
|
||||||
|
<input type="email" id="email" name="email" value="{{ old('email') }}" required
|
||||||
|
class="w-full px-3 py-2 border rounded focus:outline-none focus:border-orange-500">
|
||||||
|
@error('email')
|
||||||
|
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="password" class="block text-gray-700 font-bold mb-2">Password</label>
|
||||||
|
<input type="password" id="password" name="password" required
|
||||||
|
class="w-full px-3 py-2 border rounded focus:outline-none focus:border-orange-500">
|
||||||
|
@error('password')
|
||||||
|
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-6">
|
||||||
|
<label for="password_confirmation" class="block text-gray-700 font-bold mb-2">Confirm Password</label>
|
||||||
|
<input type="password" id="password_confirmation" name="password_confirmation" required
|
||||||
|
class="w-full px-3 py-2 border rounded focus:outline-none focus:border-orange-500">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="w-full bg-orange-600 text-white py-2 rounded hover:bg-orange-700 font-bold">
|
||||||
|
Sign Up
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p class="mt-4 text-center text-gray-600">
|
||||||
|
Already have an account? <a href="{{ route('login') }}" class="text-orange-600 hover:underline">Login</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
48
resources/views/layout.blade.php
Normal file
48
resources/views/layout.blade.php
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>@yield('title', 'Reddit Clone')</title>
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
</head>
|
||||||
|
<body class="bg-gray-100">
|
||||||
|
<nav class="bg-white shadow-lg">
|
||||||
|
<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 items-center space-x-8">
|
||||||
|
<a href="{{ route('home') }}" class="text-2xl font-bold text-orange-600">Reddit Clone</a>
|
||||||
|
<a href="{{ route('home') }}" class="text-gray-700 hover:text-gray-900">Home</a>
|
||||||
|
<a href="{{ route('communities.index') }}" class="text-gray-700 hover:text-gray-900">Communities</a>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center space-x-4">
|
||||||
|
@auth
|
||||||
|
<a href="{{ route('posts.create') }}" class="bg-orange-600 text-white px-4 py-2 rounded hover:bg-orange-700">Create Post</a>
|
||||||
|
<a href="{{ route('communities.create') }}" class="text-gray-700 hover:text-gray-900">Create Community</a>
|
||||||
|
<a href="{{ route('users.show', auth()->user()) }}" class="text-gray-700 hover:text-gray-900">{{ auth()->user()->name }} ({{ auth()->user()->karma }})</a>
|
||||||
|
<form action="{{ route('logout') }}" method="POST" class="inline">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="text-gray-700 hover:text-gray-900">Logout</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
<a href="{{ route('login') }}" class="text-gray-700 hover:text-gray-900">Login</a>
|
||||||
|
<a href="{{ route('register') }}" class="bg-orange-600 text-white px-4 py-2 rounded hover:bg-orange-700">Sign Up</a>
|
||||||
|
@endauth
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-4">
|
||||||
|
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||||
|
@yield('content')
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in a new issue