diff --git a/config/blog.php b/config/blog.php index 49de2ab..ca93208 100644 --- a/config/blog.php +++ b/config/blog.php @@ -13,4 +13,15 @@ return [ 'publishing_name' => 'Jon\'s Words', + /* + |-------------------------------------------------------------------------- + | Subheading + |-------------------------------------------------------------------------- + | + | The one sentence abbreviation of the blog that will display below the name + | + */ + + 'subheading' => 'A blog with an as yet unclear direction.', + ]; diff --git a/database/factories/ArticleFactory.php b/database/factories/ArticleFactory.php index 7bd6543..ccb51b1 100644 --- a/database/factories/ArticleFactory.php +++ b/database/factories/ArticleFactory.php @@ -76,7 +76,7 @@ class ArticleFactory extends Factory $dice_roll = rand(0,100); if($dice_roll <= 50) { // Make a SubTitle - $markdown_result .= '# ' . fake()->words(rand(1,5), true) . "\n"; + $markdown_result .= '## ' . fake()->words(rand(1,5), true) . "\n"; } elseif ($dice_roll <= 100) { // Make a paragraph $markdown_result .= fake()->sentences(rand(2,5), true) . "\n"; } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index c148c63..14cf441 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -22,5 +22,12 @@ class DatabaseSeeder extends Seeder $test_author = Author::factory()->user($test_user)->create(); Article::factory()->author($test_author)->count(30)->create(); + + $random_article = Article::where('id', '<', 10)->inRandomOrder()->first(); + + $random_article->body = ""; + $random_article->save(); } } diff --git a/public/word-salad.css b/public/word-salad.css index 9aac2b4..4c51a48 100644 --- a/public/word-salad.css +++ b/public/word-salad.css @@ -1,3 +1,31 @@ @view-transition { navigation: auto; } + +body { + background-color: #813d9c; /* Primary Purple */ + color: white; + text-shadow: 1px 1px 2px blueviolet; +} + +a { + text-decoration-color: aqua; + color: aqua; +} + +#top-bar { + padding: 0.5em; + background-color: rgba(red, green, blue, 0.2); + border-bottom: 1px solid white; + display: flex; + align-items: center; + justify-content: center; +} + +.bubble-panel { + border-radius: 50px; + background: #813d9c; + box-shadow: -33px 33px 65px #66307b, + 33px -33px 65px #9c4abd; + padding: 2em; +} diff --git a/resources/views/article-preview.blade.php b/resources/views/article-preview.blade.php deleted file mode 100644 index 1fa0ba3..0000000 --- a/resources/views/article-preview.blade.php +++ /dev/null @@ -1,6 +0,0 @@ -
-

{{ $article['title'] }}

-

hey

- -

{{ Illuminate\Support\Str::limit($article['body'], 200) }}

-
diff --git a/resources/views/all-articles.blade.php b/resources/views/guest/all-articles.blade.php similarity index 55% rename from resources/views/all-articles.blade.php rename to resources/views/guest/all-articles.blade.php index a1735b3..e5048db 100644 --- a/resources/views/all-articles.blade.php +++ b/resources/views/guest/all-articles.blade.php @@ -1,8 +1,14 @@ +@extends('layouts.guest') + +@section('title', 'Recent Articles') + +@section('content')
Count: {{ count($all_articles) }} @forelse($all_articles as $index => $article) - @include('article-preview') + @include('guest.article-preview') @empty

No articles found, unlucky.

@endforelse
+@endsection diff --git a/resources/views/guest/article-preview.blade.php b/resources/views/guest/article-preview.blade.php new file mode 100644 index 0000000..64abb1a --- /dev/null +++ b/resources/views/guest/article-preview.blade.php @@ -0,0 +1,6 @@ +
+

{{ $article['title'] }}

+

hey

+ +

{!! Illuminate\Support\Str::limit($article['body'], 100) !!}

+
diff --git a/resources/views/guest/article.blade.php b/resources/views/guest/article.blade.php new file mode 100644 index 0000000..1940f85 --- /dev/null +++ b/resources/views/guest/article.blade.php @@ -0,0 +1,22 @@ +@extends('layouts.guest') + +@section('title', $article['title']) + +@section('content') +
+   ← Go Back + +

{{ $article['title'] }}

+

{{ $article['subtitle'] }}

+

{{ $article['author']['display_name'] }}

+

Published At: {{ $article['published_at'] }}

+ +
+ {!! $article['body'] !!} +
+
+@endsection diff --git a/resources/views/guest/home.blade.php b/resources/views/guest/home.blade.php new file mode 100644 index 0000000..9e949b3 --- /dev/null +++ b/resources/views/guest/home.blade.php @@ -0,0 +1,10 @@ +@extends('layouts.guest') + +@section('title', 'Home') + +@section('content') +
+

{{ config('blog.publishing_name') }}

+

{{ config('blog.subheading') }}

+

+@endsection diff --git a/resources/views/guest/top-bar.blade.php b/resources/views/guest/top-bar.blade.php new file mode 100644 index 0000000..9ec01c4 --- /dev/null +++ b/resources/views/guest/top-bar.blade.php @@ -0,0 +1,3 @@ +
+ UNRWA is working tirelessly to alleviate the horrors of genocide in Gaza. Support them here ðŸ‡µðŸ‡¸ +
diff --git a/resources/views/home.blade.php b/resources/views/layouts/guest.blade.php similarity index 60% rename from resources/views/home.blade.php rename to resources/views/layouts/guest.blade.php index 401172c..c01ee8c 100644 --- a/resources/views/home.blade.php +++ b/resources/views/layouts/guest.blade.php @@ -6,12 +6,14 @@ - {{ config('blog.publishing_name') }} | Home + {{ config('blog.publishing_name') }} | @yield('title') + + @include('guest.top-bar') +
-

Hey guys, check back soon for some word-based #content

- Recent Articles + @yield('content', 'Nothing to see here.')
diff --git a/resources/views/admin-home.blade.php b/resources/views/layouts/writer.blade.php similarity index 100% rename from resources/views/admin-home.blade.php rename to resources/views/layouts/writer.blade.php diff --git a/routes/web.php b/routes/web.php index 02ac18b..e9cac4e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Route; */ Route::get('/', function () { - return view('home'); + return view('guest.home'); }); Route::get('/test-insert', function () { @@ -24,5 +24,17 @@ Route::get('/test-insert', function () { Route::get('/recent-articles', function () { $all_articles = Article::where('published_at', '<', now())->limit(10)->get(); - return view('all-articles', ['all_articles' => $all_articles]); + return view('guest.all-articles', ['all_articles' => $all_articles]); })->name('recent-articles'); + +Route::get('/post/{article_slug}', function ($article_slug) { + $active_article = Article::with('author') + ->where('published_at', '<', now()) + ->where('slug', $article_slug) + ->first(); + + if(empty($active_article)) { + return abort(404); + } + return view('guest.article', ['article' => $active_article]); +})->name('article');