1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00

Merge pull request #1 from stancl/fancy-design

Fancy new design
This commit is contained in:
Samuel Štancl 2021-04-07 19:24:30 +02:00 committed by GitHub
commit 3c618a2209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 8756 additions and 2153 deletions

View file

@ -2,12 +2,8 @@
namespace App\Providers;
use App\MarkdownCompiler;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use League\CommonMark\GithubFlavoredMarkdownConverter;
use Illuminate\Support\Str;
class AppServiceProvider extends ServiceProvider
{
@ -30,18 +26,6 @@ class AppServiceProvider extends ServiceProvider
{
Model::unguard();
Blade::directive('markdown', function (string $expression = '') {
if ($expression) {
return MarkdownCompiler::compileMarkdownString($expression);
}
return '<?php $__markdownOldBuffer = ob_get_clean(); ob_start(); ?>';
});
Blade::directive('endmarkdown', function () {
return '<?php $__markdownString = ob_get_clean(); ob_start(); echo $__markdownOldBuffer; unset($__markdownOldBuffer); echo \App\MarkdownCompiler::compileMarkdownString($__markdownString); unset($__markdownString); ?>';
});
view()->share('telegram', 'https://t.me/LaravelCodeTips');
view()->share('newsletter', 'https://newsletter.laravel-code.tips');
view()->share('twitter', 'https://twitter.com/LaravelCodeTips');

3690
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,6 @@
},
"devDependencies": {
"@hotwired/turbo": "^7.0.0-beta.4",
"@tailwindcss/jit": "^0.1.17",
"@tailwindcss/typography": "^0.4.0",
"alpine-turbo-drive-adapter": "^1.0.2",
"alpinejs": "^2.8.2",

1728
public/css/app.css vendored

File diff suppressed because one or more lines are too long

5043
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=1c9c0a8a53dbb967504e",
"/css/app.css": "/css/app.css?id=0eeb0c58e5eb6a114a46"
"/js/app.js": "/js/app.js?id=dcd6a25505aca8a1b0cb",
"/css/app.css": "/css/app.css?id=a4be474b1dff83dbf938"
}

View file

@ -2,6 +2,8 @@
@import "tailwindcss/components";
@import "tailwindcss/utilities";
.link {
@apply border-b-2 border-gray-100 hover:border-gray-400 transition;
@layer base {
.prose a {
@apply relative;
}
}

View file

@ -0,0 +1,37 @@
@props(['tip'])
<div class="flex w-full p-6 space-x-6 bg-gray-50 rounded-2xl">
<a href="{{ $tip->author->profile_url }}" target="_blank">
<img class="bg-gray-200 rounded-full w-14 h-14" src="{{ asset($tip->author->avatar) }}"
alt="{{ $tip->author->name }}">
</a>
<aside class="flex-1 space-y-2 text-left">
<a href="{{ $tip->author->profile_url }}" target="_blank"
class="block text-xl font-bold">{{ $tip->author->name }}</a>
<dl class="grid gap-6 sm:grid-cols-2 md:grid-cols-4">
@if ($tip->thread)
<div>
<dt class="text-sm text-gray-500">Thread</dt>
<dd>
<x-link href="{{ route('thread.show', $tip->thread->slug, false) }}">
{{ $tip->thread->title }}
</x-link>
</dd>
</div>
@endif
<div>
<dt class="text-sm text-gray-500">Tweet</dt>
<dd>
<x-link href="{{ $tip->tweet_url }}" target="_blank">
twitter.com/...
</x-link>
</dd>
</div>
</dl>
</aside>
</div>

View file

@ -0,0 +1 @@
<div class="w-full max-w-4xl px-4 mx-auto sm:px-6 md:px-8">{{ $slot }}</div>

View file

@ -1,23 +1,45 @@
@props([
'tips',
])
@props(['tips'])
<section role="feed" class="my-8">
@foreach($tips as $tip)
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = '{{ route('tip.show', $tip) }}'">
<h1 class="text-3xl font-medium">
<a href="{{ route('tip.show', $tip) }}">🔥 {{ $tip->title }}</a>
</h1>
<section role="feed" class="divide-y">
@foreach ($tips as $tip)
<div class="py-12 md:py-24 {{ $loop->odd ?: 'bg-gray-50' }}">
<div class="w-full max-w-4xl px-4 mx-auto sm:px-6 md:px-8">
<article
class="flex flex-col items-center space-y-6 md:space-y-12 text-center group transition transform active:scale-[0.99] duration-75 relative"
role="article">
<a class="absolute inset-0 w-full h-full" title="{{ $tip->title }}"
href="{{ route('tip.show', $tip, false) }}">
<span class="sr-only">{{ $tip->title }}</span>
</a>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
@foreach($tip->images() as $image)
<img alt="{{ $tip->title }}" src="{{ $image->small() }}">
@endforeach
<div
class="transition duration-200 transform shadow rounded-2xl group-hover:rotate-6 group-hover:-translate-y-2 group-hover:shadow-md">
<div
class="flex items-center justify-center w-16 h-16 text-2xl font-bold shadow-xl bg-gradient-to-b from-white to-pink-50 rounded-2xl tabular-nums">
<p
class="text-transparent transition duration-300 transform bg-gradient-to-br from-yellow-400 to-pink-400 bg-clip-text group-hover:scale-105 group-hover:rotate-6">
{{ count($tips) - $loop->index }}
</p>
</div>
</div>
<h2 class="text-xl font-bold tracking-tight md:text-4xl">
🔥 {{ $tip->title }}
</h2>
@if ($tip->images())
@foreach ($tip->images() as $image)
<img class="shadow-xl rounded-xl" src="{{ $image->small() }}" alt="{{ $tip->title }}">
@endforeach
@endif
@if ($tip->content)
<div class="prose break-all md:prose-xl">
{!! Str::of($tip->content)->markdown() !!}
</div>
@endif
</article>
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
@markdown{!! $tip->content !!}@endmarkdown
</section>
</article>
</div>
@endforeach
</section>

View file

@ -4,13 +4,12 @@
])
@php
$title = $title
? $title . ' | Laravel Code Tips'
: 'Laravel Code Tips';
$title = $title ? $title . ' | Laravel Code Tips' : 'Laravel Code Tips';
@endphp
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -26,9 +25,11 @@
<meta property="og:title" content="{{ $title }}" />
<meta property="og:description" content="Make your Laravel code cleaner, faster, and safer." />
@if($preview)
<meta property="og:image" content="https://i.useflipp.com/g6demrp3y3rz.png?content={{ urlencode(html_entity_decode($preview)) }}" />
<meta property="twitter:image" content="https://i.useflipp.com/g6demrp3y3rz.png?content={{ urlencode(html_entity_decode($preview)) }}" />
@if ($preview)
<meta property="og:image"
content="https://i.useflipp.com/g6demrp3y3rz.png?content={{ urlencode(html_entity_decode($preview)) }}" />
<meta property="twitter:image"
content="https://i.useflipp.com/g6demrp3y3rz.png?content={{ urlencode(html_entity_decode($preview)) }}" />
@else
<meta property="og:image" content="{{ asset('og.png') }}" />
<meta property="twitter:image" content="{{ asset('og.png') }}" />
@ -45,14 +46,28 @@
<meta name="theme-color" content="#fa7c4c">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
{{ $slot }}
<footer class="space-y-2 text-gray-700 text-sm pt-8">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://github.com/stancl/laravel-tips" target="_blank" class="link">here</a>.</p>
</footer>
</div>
<body class="flex flex-col min-h-screen font-sans antialiased text-gray-800">
{{ $slot }}
<footer class="py-12 border-t">
<ul class="px-4 space-y-4 text-center text-gray-500">
<li>
Found an error? Contact us at
<x-link href="mailto:hello@laravel-code.tips">support@laravel-code.tips</x-link>
</li>
<li>
Want to share a tip? Submit it
<x-link target="_blank" href="https://github.com/stancl/laravel-tips">here</x-link>
</li>
<li>
Designed with <span class="text-red-500">❤️</span> by
<x-link target="_blank" href="http://twitter.com/larsKlopstra/">@larsklopstra</x-link>
</li>
</ul>
</footer>
</body>
</html>

View file

@ -0,0 +1 @@
<a {{ $attributes->class('inline transition border-b-2 border-gray-200 hover:border-orange-500 focus:outline-none focus:border-orange-600') }}>{{ $slot }}</a>

View file

@ -0,0 +1,24 @@
<ul class="inline-grid grid-flow-col gap-4">
<li>
<a class="transition border-b-2 border-pink-100 hover:border-pink-900 focus:outline-none focus:border-pink-900"
href="{{ $twitter }}">Twitter</a>
</li>
<li>
<span>&centerdot;</span>
</li>
<li>
<a class="transition border-b-2 border-pink-100 hover:border-pink-900 focus:outline-none focus:border-pink-900"
href="{{ $telegram }}">Telegram</a>
</li>
<li>
<span>&centerdot;</span>
</li>
<li>
<a class="transition border-b-2 border-pink-100 hover:border-pink-900 focus:outline-none focus:border-pink-900"
href="{{ $newsletter }}">Newsletter</a>
</li>
</ul>

View file

@ -1,53 +1,31 @@
<x:layout :title="$thread->title">
<main class="mx-auto flex flex-col sm:flex-row justify-between items-start gap-8">
<aside class="flex flex-col gap-2 sm:mt-60 sm:mx-0 mx-auto">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="{{ $twitter }}" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="{{ $newsletter }}" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="{{ $telegram }}" target="_blank">
<span class="link">Telegram</span>
</a>
<x:layout>
<header class="relative py-24">
<div
class="absolute w-full transform skew-y-12 pointer-events-none h-72 md:h-96 -translate-y-1/4 bg-gradient-to-br from-yellow-300 to-pink-400 mix-blend-multiply">
</div>
<x:container>
<div class="flex flex-col items-center space-y-6 text-center text-yellow-900">
<h1 class="text-4xl font-bold tracking-tighter md:text-5xl lg:text-8xl">
🔥 {{ $thread->title }}
</h1>
<div class="prose md:prose-xl">
{!! Str::markdown($thread->content) !!}
</div>
<x:socials />
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 {{ $thread->title }}</h1>
<div class="prose text-xl">@markdown{!! $thread->content !!}@endmarkdown</div>
</x:container>
</header>
<x:feed :tips="$tips" />
</header>
</article>
<aside class="sm:mt-60">
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="{{ $thread->author->profile_url }}" class="flex items-center gap-2" target="_blank">
<img src="{{ $thread->author->avatar }}" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">{{ $thread->author->name }}</span>
</a>
</dd>
<main class="flex-1 divide-y" role="feed">
<x:feed :tips="$tips" />
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="{{ $thread->tweet_url }}" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
<section class="py-12 bg-white md:py-24">
<x:container>
<x:author-card :tip="$thread" />
</x:container>
</section>
</main>
</x:layout>

View file

@ -1,22 +1,21 @@
<x:layout>
<header class="mt-8">
<h1 class="text-5xl w-full">Laravel Code Tips</h1>
<h2 class="mt-6 text-2xl text-gray-700">Make your Laravel code cleaner, faster, and safer.</h2>
<div class="mt-6 text-gray-800 text-lg">
<a class="inline" href="{{ $twitter }}" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-1">·</span>
<a class="inline" href="{{ $newsletter }}" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-1">·</span>
<a class="inline" href="{{ $telegram }}" target="_blank">
<span class="link">Telegram</span>
</a>
<header class="relative py-24">
<div
class="absolute w-full transform skew-y-12 pointer-events-none h-72 md:h-96 -translate-y-1/4 bg-gradient-to-br from-yellow-300 to-pink-400 mix-blend-multiply">
</div>
<x-container>
<div class="flex flex-col items-center space-y-6 text-center text-yellow-900">
<h1 class="text-4xl font-bold tracking-tighter md:text-5xl lg:text-8xl">Laravel Code Tips</h1>
<p class="text-xl font-medium">Make your Laravel code cleaner, faster, and safer.</p>
<x:socials />
</div>
</x-container>
</header>
<main class="mx-auto flex justify-between items-center gap-8 sm:w-1/2">
<main class="flex-1 divide-y" role="feed">
<x:feed :tips="$tips" />
</main>
</x:layout>

View file

@ -1,71 +1,53 @@
<x:layout :title="$tip->title" :preview="$tip->title">
<main class="mx-auto flex flex-col sm:flex-row justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="{{ $twitter }}" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="{{ $newsletter }}" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="{{ $telegram }}" target="_blank">
<span class="link">Telegram</span>
</a>
<x:layout>
<div
class="fixed inset-0 z-40 items-center justify-between hidden w-full h-screen p-16 pointer-events-none lg:flex">
<a class="rounded-full shadow-md pointer-events-auto" href="#">
<div class="flex items-center justify-center w-16 h-16 bg-white rounded-full shadow-2xl">
<svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 text-orange-500" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
</svg>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 {{ $tip->title }}</h1>
</a>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
@foreach($tip->images() as $image)
<a href="{{ $image->large() }}" target="_blank">
<img alt="{{ $tip->title }}" src="{{ $image->small() }}">
</a>
@endforeach
<a class="rounded-full shadow-md pointer-events-auto" href="#">
<div class="flex items-center justify-center w-16 h-16 bg-white rounded-full shadow-2xl">
<svg xmlns="http://www.w3.org/2000/svg" class="w-8 h-8 text-orange-500" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
</div>
</a>
</div>
<main class="relative flex-1 py-24">
<div
class="absolute w-full transform skew-y-12 pointer-events-none h-72 md:h-96 -translate-y-1/4 bg-gradient-to-br from-yellow-300 to-pink-400 mix-blend-multiply">
</div>
<x:container>
<div class="flex flex-col items-center space-y-6 text-center md:space-y-12">
<div class="space-y-6 text-yellow-900">
<h1 class="text-3xl font-bold tracking-tighter md:text-5xl">{{ $tip->title }}</h1>
<x:socials />
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
@markdown{!! $tip->content !!}@endmarkdown
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="{{ $tip->author->profile_url }}" class="flex items-center gap-2" target="_blank">
<img src="{{ $tip->author->avatar }}" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">{{ $tip->author->name }}</span>
</a>
</dd>
@if($tip->thread)
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="{{ route('thread.show', $tip->thread->slug) }}">
{{ $tip->thread->title }}
</a>
</dd>
@if ($tip->images())
@foreach ($tip->images() as $image)
<img class="shadow-xl rounded-xl backdrop-filter backdrop-blur-lg backdrop-saturate-125"
src="{{ $image->small() }}" alt="{{ $tip->title }}">
@endforeach
@endif
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="{{ $tip->tweet_url }}" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
@if ($tip->content)
<div class="prose break-all md:prose-xl">
{!! Str::markdown($tip->content) !!}
</div>
@endif
<x:author-card :tip="$tip" />
</div>
</x:container>
</main>
</x:layout>

View file

@ -15,7 +15,6 @@ use Illuminate\Support\Facades\Route;
|
*/
Route::middleware('static')->group(function () {
Route::get('/', function () {
return view('tips.index', ['tips' => Tip::all()]);

41
tailwind.config.js vendored
View file

@ -1,23 +1,24 @@
const colors = require('tailwindcss/colors')
const defaultTheme = require('tailwindcss/defaultTheme')
const colors = require("tailwindcss/colors");
const defaultTheme = require("tailwindcss/defaultTheme");
module.exports = {
purge: [
'./resources/views/**/*.blade.php',
],
darkMode: 'class',
theme: {
extend: {
fontFamily: {
sans: ['iA Writer Quattro S', ...defaultTheme.fontFamily.sans],
}
purge: ["./resources/views/**/*.blade.php"],
mode: "jit",
darkMode: "class",
theme: {
extend: {
fontFamily: {
sans: ["iA Writer Quattro S", ...defaultTheme.fontFamily.sans],
},
colors: {
...colors,
},
},
},
colors,
},
variants: {
extend: {},
},
plugins: [
require('@tailwindcss/typography'),
],
}
plugins: [require("@tailwindcss/typography")],
};

2
webpack.mix.js vendored
View file

@ -14,7 +14,7 @@ const mix = require('laravel-mix');
mix
.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
require('@tailwindcss/jit'),
require('tailwindcss'),
require('autoprefixer'),
])
.version()