Skip to content

Commit

Permalink
feat: update banners (#259)
Browse files Browse the repository at this point in the history
* feat: update banners

* chore: rename component
  • Loading branch information
andreiio authored Feb 23, 2023
1 parent fe038a5 commit d594d3b
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 15 deletions.
10 changes: 10 additions & 0 deletions app/Services/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,14 @@ public static function isCode4RomaniaSite(): bool
{
return config('website-factory.edition') === 'internal';
}

/**
* Determine if the application is running a government site.
*
* @return bool
*/
public static function isGovernmentSite(): bool
{
return config('website-factory.edition') === 'minister';
}
}
28 changes: 28 additions & 0 deletions app/View/Components/Site/BannerGovernment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace App\View\Components\Site;

use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class BannerGovernment extends Component
{
public ?string $text;

public function __construct(?string $text = null)
{
$this->text = $text;
}

public function render(): View
{
return view('components.site.banner-government');
}

public function shouldRender(): bool
{
return ! config('website-factory.hide_banner') && ! \is_null($this->text);
}
}
7 changes: 5 additions & 2 deletions app/View/Components/Site/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function __construct()

public function render(): View
{
if (config('website-factory.edition') === 'minister') {
return view('components.site.footer-minister');
if (Features::isGovernmentSite()) {
return view('components.site.footer-government');
}

return view('components.site.footer');
Expand All @@ -52,6 +52,9 @@ public function banner(): ?string

return __('banner.external', [
'edition' => __('banner.edition.' . config('website-factory.edition')),
'organization' => Features::isGovernmentSite()
? 'Code for Romania'
: 'Commit Global',
]);
}
}
4 changes: 3 additions & 1 deletion app/View/Components/Site/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public function banner(): ?string
return null;
}

return __('banner.internal');
return __('banner.internal', [
'organization' => 'Commit Global',
]);
}
}
4 changes: 2 additions & 2 deletions lang/en/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

return [

'internal' => 'A Commit Global solution.',
'external' => 'Website built with Website Factory: :edition, a solution developed by Commit Global.',
'internal' => 'A :organization solution.',
'external' => 'Website built with Website Factory: :edition, a solution developed by :organization.',

'edition' => [
'primarie' => 'Primărie',
Expand Down
4 changes: 2 additions & 2 deletions lang/ro/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

return [

'internal' => 'O soluție Commit Global.',
'external' => 'Website construit cu Website Factory: :edition, soluție dezvoltată de Commit Global.',
'internal' => 'O soluție :organization.',
'external' => 'Website construit cu Website Factory: :edition, soluție dezvoltată de :organization.',

'edition' => [
'primarie' => 'Primărie',
Expand Down
2 changes: 1 addition & 1 deletion lang/ru/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
return [

'internal' => 'Продукт Commit Global.',
'external' => 'Веб-сайт создан с помощью Website Factory: :edition, решения, разработанного Commit Global.',
'external' => 'Веб-сайт создан с помощью Website Factory: :edition, решения, разработанного :organization.',

'edition' => [
'primarie' => 'Primărie',
Expand Down
4 changes: 2 additions & 2 deletions lang/uk/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

return [

'internal' => 'Продукт Commit Global.',
'external' => 'Веб-сайт, створений за допомогою Website Factory: :edition, рішення, розроблене Commit Global.',
'internal' => 'Продукт :organization.',
'external' => 'Веб-сайт, створений за допомогою Website Factory: :edition, рішення, розроблене :organization.',

'edition' => [
'primarie' => 'Primărie',
Expand Down
13 changes: 13 additions & 0 deletions resources/views/components/site/banner-government.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<aside {{ $attributes }}>
<a
href="https://code4.ro"
target="_blank"
rel="noopener"
class="flex items-center w-auto gap-3 text-sm text-white/60 hover:text-white focus-visible:text-white focus:outline-0 hover:underline focus:underline"
>

<span>{{ $text }}</span>

<x-icon-code4 class="h-6 sm:h-8 shrink-0 fill-white/80" />
</a>
</aside>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<x-dynamic-component
class="text-sm font-semibold tracking-wider text-white uppercase hover:text-white/60 focus-visible:text-white/60"
:component="$item->component"
:item="$item" />
:item="$item"
/>

@if ($item->children->count())
<ul class="space-y-4">
Expand All @@ -25,7 +26,8 @@ class="text-sm font-semibold tracking-wider text-white uppercase hover:text-whit
<x-dynamic-component
class="text-white/60 hover:text-white focus-visible:text-white"
:component="$item->component"
:item="$item" />
:item="$item"
/>
</li>
@endforeach
</ul>
Expand All @@ -36,10 +38,20 @@ class="text-white/60 hover:text-white focus-visible:text-white"
</nav>
</div>

<div class="pt-8 mt-8 border-t border-gray-200 md:flex md:items-center md:justify-between">
<x-social-media-links :links="$social" class="text-white md:order-2" />
<div
class="flex flex-col gap-4 pt-8 mt-8 border-t border-gray-200 md:flex-row md:items-center md:justify-between md:flex-wrap">

<p class="mt-8 text-white/60 md:mt-0 md:order-1">
<x-site.banner-government
:text="$banner()"
class="w-full"
/>

<x-social-media-links
:links="$social"
class="text-white md:order-2"
/>

<p class="text-white/60 md:mt-0 md:order-1">
&copy; {{ date('Y') }} {{ $title }}
</p>
</div>
Expand Down

0 comments on commit d594d3b

Please sign in to comment.