Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @extends('layouts.app')
- @section('content')
- <div class="container">
- <h1 class="page-title">Daftar Berita</h1>
- <a href="{{ route('berita.create') }}" class="btn btn-primary">Tambah Berita</a>
- <table class="news-table">
- <thead>
- <tr>
- <th>Judul</th>
- <th>Konten</th>
- <th>Aksi</th>
- </tr>
- </thead>
- <tbody>
- @foreach ($beritas as $berita)
- <tr>
- <td>{{ $berita->judul }}</td>
- <td>{{ \Str::limit($berita->konten, 50) }}</td> <!-- Limit content to 50 characters for a cleaner view -->
- <td class="actions">
- <a href="{{ route('berita.show', $berita->id_berita) }}" class="btn btn-info">Lihat</a>
- <a href="{{ route('berita.edit', $berita->id_berita) }}" class="btn btn-warning">Edit</a>
- <form action="{{ route('berita.destroy', $berita->id_berita) }}" method="POST" style="display:inline;">
- @csrf
- @method('DELETE')
- <button type="submit" class="btn btn-danger">Hapus</button>
- </form>
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
- </div>
- @endsection
- @section('css')
- <style>
- .container {
- width: 90%;
- max-width: 1200px; /* Maximum width for larger screens */
- margin: 0 auto;
- }
- .page-title {
- font-size: 2.5rem;
- margin-bottom: 20px;
- font-weight: bold;
- color: #333;
- text-align: center;
- }
- .btn {
- padding: 10px 20px;
- text-align: center;
- border-radius: 5px;
- text-decoration: none;
- display: inline-block;
- font-size: 14px;
- margin-right: 5px;
- cursor: pointer;
- transition: background-color 0.3s ease;
- }
- .btn-primary {
- background-color: #007bff;
- color: white;
- border: none;
- }
- .btn-primary:hover {
- background-color: #0056b3;
- }
- .btn-info {
- background-color: #17a2b8;
- color: white;
- border: none;
- }
- .btn-info:hover {
- background-color: #138496;
- }
- .btn-warning {
- background-color: #ffc107;
- color: white;
- border: none;
- }
- .btn-warning:hover {
- background-color: #e0a800;
- }
- .btn-danger {
- background-color: #dc3545;
- color: white;
- border: none;
- }
- .btn-danger:hover {
- background-color: #c82333;
- }
- .news-table {
- width: 100%;
- border-collapse: collapse;
- margin-top: 20px;
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
- }
- .news-table th, .news-table td {
- padding: 15px;
- text-align: left;
- border: 1px solid #ddd;
- }
- .news-table th {
- background-color: #f8f9fa;
- font-weight: bold;
- color: #333;
- }
- .news-table tbody tr:hover {
- background-color: #f1f1f1;
- }
- .actions {
- display: flex;
- gap: 10px;
- justify-content: center;
- }
- .actions form {
- margin: 0;
- }
- /* Responsive Design */
- @media (max-width: 768px) {
- .container {
- width: 100%;
- }
- .page-title {
- font-size: 2rem;
- }
- .btn {
- width: 100%;
- margin-bottom: 10px;
- }
- .news-table th, .news-table td {
- padding: 10px;
- }
- }
- </style>
- @endsection
Advertisement
Add Comment
Please, Sign In to add comment