WIP: Get very basics of recent articles page

This commit is contained in:
Jonathan Nielson 2024-08-03 23:50:42 -05:00
parent d91b49275f
commit 2b677ef1e5
7 changed files with 65 additions and 3 deletions

3
public/word-salad.css Normal file
View File

@ -0,0 +1,3 @@
@view-transition {
navigation: auto;
}

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Include our local version of HTMX -->
<script src="/htmx.1.9.12.js"></script>
<link href="/word-salad.css" rel="stylesheet" />
<title>{{ config('blog.publishing_name') }} | Home</title>
</head>
<body>
<main>
<h2>Hey guys, check back soon for some word-based #content</h2>
<div id="button-container">
<button hx-get="{{ route('surprise') }}"
hx-trigger="click"
hx-target="#button-container"
hx-swap="outerHTML"
>
Click Me!
</button>
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,8 @@
<div>
Count: {{ count($all_articles) }}
@forelse($all_articles as $index => $article)
@include('article-preview')
@empty
<h4>No articles found, unlucky.</h4>
@endforelse
</div>

View File

@ -0,0 +1,6 @@
<article>
<h2>{{ $article['title'] }}</h2>
<p>hey</p>
<img src="{{ $article['header_image_url']}}" />
<p>{{ Illuminate\Support\Str::limit($article['body'], 200) }}</p>
</article>

View File

@ -4,11 +4,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/word-salad.css" rel="stylesheet" />
<title>{{ config('blog.publishing_name') }} | Home</title>
</head>
<body>
<main>
<h2>Hey guys, check back soon for some word-based #content</h2>
</main>
<main>
<h2>Hey guys, check back soon for some word-based #content</h2>
<a href="{{ route('recent-articles') }}">Recent Articles</a>
</main>
</body>
</html>

View File

@ -0,0 +1,3 @@
<section class="hot-new-info">
<h3>Hot new test info</h3>
</section>

View File

@ -1,5 +1,6 @@
<?php
use App\Models\Article;
use Illuminate\Support\Facades\Route;
/*
@ -16,3 +17,12 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('home');
});
Route::get('/test-insert', function () {
return view('test-insert');
})->name('test-insert');
Route::get('/recent-articles', function () {
$all_articles = Article::where('published_at', '<', now())->limit(10)->get();
return view('all-articles', ['all_articles' => $all_articles]);
})->name('recent-articles');