Compare commits

..

2 Commits

6 changed files with 131 additions and 27 deletions

View File

@ -0,0 +1,28 @@
<?php
namespace App\View\Components;
use App\Models\Bookmark as ModelsBookmark;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class Bookmark extends Component
{
/**
* Create a new component instance.
*/
public function __construct(
public ModelsBookmark $bookmark
) {
//
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.bookmark');
}
}

View File

@ -1,22 +1,88 @@
* {
box-sizing: border-box;
}
html {
margin: 0;
padding: 0;
}
body { body {
font-family: Helvetica, Arial, sans-serif; margin: 0;
background-color: hsl(100, 50%, 90%); padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;
background-color: #335C67;
}
h1 {
color: #FFF3B0;
text-align: center;
} }
.container { .container {
max-width: 40rem; max-width: 40rem;
margin: 1em auto;
} }
.bookmark { .bookmark {
padding: 1ex; display: grid;
align-items: center;
gap: 0px 0px;
grid-template-areas:
"title title"
"href href"
"description description"
"date tags";
margin-bottom: 1em;
padding: 0;
border: 2px solid #540B0E;
background-color: #FFF3B0;
&-title { &-title {
margin-top: 0; margin: 0;
padding: 1ex;
background-color: #E09F3E;
grid-area: title;
font-weight: bold;
}
&-href,
&-description,
&-date,
&-tags {
padding: 1ex;
margin: 0;
}
&-href,
&-description,
&-date {
font-size: 0.9em;
}
&-href {
grid-area: href;
}
&-description {
grid-area: description;
> p {
border-left: 3px solid #9E2A2B;
margin: 0;
padding: 0.5ex 0 0.5ex 1ex;
}
}
&-date {
grid-area: date;
} }
&-tags { &-tags {
padding: 0; font-size: 0.8em;
margin: 1em 0; grid-area: tags;
text-align: right;
} }
&-tag { &-tag {
@ -26,7 +92,7 @@ body {
margin: 0 0 0.2ex 0; margin: 0 0 0.2ex 0;
border-radius: 7px; border-radius: 7px;
background-color: hsl(230, 50%, 50%); background-color: #9E2A2B;
color: #fff; color: #FFF3B0;
} }
} }

View File

@ -1,5 +1,9 @@
@extends('layouts.app')
@section('content')
@foreach ($bookmarks as $bookmark) @foreach ($bookmarks as $bookmark)
<x-bookmark :bookmark="$bookmark" />
@include('bookmarks.show')
@endforeach @endforeach
@endsection

View File

@ -1,19 +1,5 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="bookmark"> <x-bookmark :bookmark="$bookmark" />
<p class="bookmark-title">{{ $bookmark->title }}</p>
<p class="bookmark-href"><a href="{{ $bookmark->href }}">{{ $bookmark->href }}</a></p>
@if ($bookmark->description)
<p class="bookmark-description">{{ $bookmark->description }}</p>
@endif
<p>{{ $bookmark->created_at }}</p>
<ul class="bookmark-tags">
@foreach ($bookmark->tags as $tag)
<li class="bookmark-tag">
{{ $tag->tag->name }}
</li>
@endforeach
</ul>
</div>
@endsection @endsection

View File

@ -0,0 +1,19 @@
<div class="bookmark">
<p class="bookmark-title">{{ $bookmark->title }}</p>
<p class="bookmark-href"><a href="{{ $bookmark->href }}">{{ $bookmark->href }}</a></p>
@if (!empty($bookmark->description))
<div class="bookmark-description">
<p>{{ strip_tags($bookmark->description) }}</p>
</div>
@endif
<p class="bookmark-date">
<time datetime="{{ $bookmark->created_at }}">{{ $bookmark->created_at->diffForHumans() }}</time>
</p>
<ul class="bookmark-tags">
@foreach ($bookmark->tags as $tag)
<li class="bookmark-tag">
{{ $tag->tag->name }}
</li>
@endforeach
</ul>
</div>

View File

@ -1,11 +1,12 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<title>urlslug</title> <title>urlsnail</title>
@vite(['resources/sass/app.scss']) @vite(['resources/sass/app.scss'])
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1>url snail</h1>
@yield('content') @yield('content')
</div> </div>
</body> </body>