Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- add page with downloadable materials #394

Merged
merged 9 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/Http/Controllers/LogoController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Blumilk\Website\Http\Controllers;

use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;

class LogoController extends Controller
{
public function __invoke(Factory $factory): View
{
return $factory->make("logo");
}
}
1 change: 1 addition & 0 deletions environment/dev/app/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ http {
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}

location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Expand Down
1 change: 1 addition & 0 deletions lang/en/alt.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
"linkedin" => "LinkedIn icon",
"facebook" => "Facebook icon",
"youtube" => "YouTube icon",
"download" => "download icon",
];
1 change: 1 addition & 0 deletions lang/en/buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
"apply_now" => "Apply now!",
"back_to_portfolio" => "Back to portfolio",
"accept_all" => "Accept all",
"download" => "Download",
];
4 changes: 4 additions & 0 deletions lang/en/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,8 @@
"text_2" => "privacy policy.",
],
"at" => "at",
"logo" => [
"title_1" => "Download",
"title_2" => "materials",
],
];
14 changes: 14 additions & 0 deletions lang/en/materials.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

return [
"brand_book" => [
"title" => "Brand book",
"description" => "Set of rules for the use of logos",
],
"logo" => [
"title" => "Logo",
"description" => "Logo in png, pdf, svg formats",
],
];
4 changes: 4 additions & 0 deletions lang/en/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@
"title" => "Company data",
"description" => "Company data of Blumilk Sp. z o.o.",
],
"logo" => [
"title" => "Downloads",
"description" => "Downloads materials like logo or brand guide.",
],
];
1 change: 1 addition & 0 deletions lang/pl/alt.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
"linkedin" => "ikona LinkedIn",
"facebook" => "ikona Facebook",
"youtube" => "ikona YouTube",
"download" => "ikona pobierania",
];
1 change: 1 addition & 0 deletions lang/pl/buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
"apply_now" => "Aplikuj teraz!",
"back_to_portfolio" => "Wróć do portfolio",
"accept_all" => "Akceptuj wszystkie",
"download" => "Pobierz",
];
4 changes: 4 additions & 0 deletions lang/pl/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,8 @@
"text_2" => "politykę prywatności.",
],
"at" => "w",
"logo" => [
"title_1" => "Materiały",
"title_2" => "do pobrania",
],
];
14 changes: 14 additions & 0 deletions lang/pl/materials.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

return [
"brand_book" => [
"title" => "Księga znaków",
"description" => "Zbiór zasad wykorzystania logotypu",
],
"logo" => [
"title" => "Logo",
"description" => "Logo w formatach png, pdf, svg",
],
];
4 changes: 4 additions & 0 deletions lang/pl/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@
"title" => "Dane firmy",
"description" => "Dane firmy Blumilk Sp. z o.o.",
],
"logo" => [
"title" => "Materiały do pobrania",
"description" => "Materiały do pobrania takie jak logo czy księga znaków.",
],
];
Binary file added public/materials/brand_book.pdf
Binary file not shown.
Binary file added public/materials/logo.zip
Binary file not shown.
5 changes: 3 additions & 2 deletions resources/views/components/small-primary-button.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<a type="button"
class="block shadow-sm text-base h-12 3xl:text-lg text-center transform transition hover:scale-110 rounded-lg bg-website-normal px-6 3xl:px-5 py-3 font-normal leading-7.5 text-white flex items-center justify-center"
@isset($href) href="{{ $href }}" @endisset>
{{ $attributes->merge([
'class' => "block shadow-sm text-base h-12 3xl:text-lg text-center transform transition hover:scale-110 rounded-lg bg-website-normal px-6 3xl:px-5 py-3 font-normal leading-7.5 text-white flex items-center justify-center" ]) }}
@isset($href) href="{{ $href }}" @endisset>
{{$slot}}
</a>
59 changes: 59 additions & 0 deletions resources/views/logo.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
@extends("layout.public", ["excludeBigBubbles" => true])

@php
$filesDirectory = public_path("materials");
$materials = [];

if (file_exists($filesDirectory) && is_dir($filesDirectory)) {
foreach (scandir($filesDirectory) as $file) {
if (!in_array($file, [".", ".."])) {
$fileKey = pathinfo($file, PATHINFO_FILENAME);
$filePath = $filesDirectory . "/" . $file;

$materials[] = [
"title" => __("materials.{$fileKey}.title"),
"description" => __("materials.{$fileKey}.description"),
"file_type" => pathinfo($file, PATHINFO_EXTENSION),
"file_size" => number_format(filesize($filePath) / 1048576, 2) . " MB",
"download_url" => asset("materials/" . $file),
];
}
}
}
@endphp

@section("title", __("meta.logo.title"))
@section("description", __("meta.logo.description"))

@section("content")
<section class="py-12 text-center mx-[10%] lg:mx-[15%] 2xl:max-w-7xl 2xl:mx-auto">
<div class="pb-24">
<h2 class="font-semibold text-gray-900 text-3xl md:text-4xl lg:text-5xl text-center 2xl:justify-start 2xl:text-start pb-4">
<span class="inline">{{ __("content.logo.title_1") }}</span>
<span class="inline text-website-normal leading-7.5">{{ __("content.logo.title_2") }}</span>
</h2>
</div>

@foreach($materials as $material)
<div class="bg-white border border-gray-200 rounded-lg flex flex-col md:flex-row justify-center md:justify-between py-4 md:py-8 px-5 md:px-10 items-center shadow-sm mb-6 space-y-4 md:space-y-0">
<div class="flex flex-col md:flex-row items-center space-y-4 md:space-y-0">
<div class="relative w-[220px] md:w-[180px] h-[150px] sm:h-[180px] md:h-[105px] bg-gray-100 flex items-center justify-center rounded-md md:mr-4">
<i class="ti ti-paperclip text-website-normal -rotate-45 text-xl"></i>
<span class="absolute bottom-2 left-2 bg-website-normal text-white text-[10px] font-medium px-2 py-1">
{{ $material["file_type"] }}, {{ $material["file_size"] }}
</span>
</div>
<div class="text-center md:text-left space-y-2 md:space-y-3">
<h2 class="text-lg font-semibold text-gray-800">{{ $material["title"] }}</h2>
<p class="text-sm text-gray-500">{{ $material["description"] }}</p>
</div>
</div>
<x-small-primary-button href="{{ $material['download_url'] }}" class="font-semibold text-sm w-full md:w-auto">
<span>{{ __("buttons.download") }}</span>
<span class="sr-only">{{ __("alt.download") }}</span>
<i class="ti ti-download text-lg text-white ml-2 font-semibold"></i>
</x-small-primary-button>
</div>
@endforeach
</section>
@endsection
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Blumilk\Website\Http\Controllers\CompanyDataController;
use Blumilk\Website\Http\Controllers\ContactController;
use Blumilk\Website\Http\Controllers\HomeController;
use Blumilk\Website\Http\Controllers\LogoController;
use Blumilk\Website\Http\Controllers\NewsController;
use Blumilk\Website\Http\Controllers\PolicyController;
use Blumilk\Website\Http\Controllers\ProjectsController;
Expand All @@ -28,6 +29,7 @@
$router->get($uri->translate("contact"), [ContactController::class, "index"])->name("contact");
$router->post($uri->translate("contact"), [ContactController::class, "store"])->name("contact.create");
$router->get($uri->translate("privacy-policy"), PolicyController::class)->name("privacy-policy");
$router->get($uri->translate("logo"), LogoController::class)->name("logo");

$router->get($uri->translate("news"), [NewsController::class, "index"])->name("news");
$router->get($uri->translate("news/{slug}"), [NewsController::class, "get"])->name("news.entry");
Expand Down
Loading