Initial commit
This commit is contained in:
5
kirby-baukasten-main/site/snippets/core/footer.php
Normal file
5
kirby-baukasten-main/site/snippets/core/footer.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
/** @var Kirby\Cms\Site $site */ ?>
|
||||
|
||||
<footer></footer>
|
||||
5
kirby-baukasten-main/site/snippets/core/nav.php
Normal file
5
kirby-baukasten-main/site/snippets/core/nav.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
/** @var Kirby\Cms\Site $site */ ?>
|
||||
|
||||
<header></header>
|
||||
7
kirby-baukasten-main/site/snippets/core/skip-nav.php
Normal file
7
kirby-baukasten-main/site/snippets/core/skip-nav.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
/** @var Kirby\Cms\Site $site */ ?>
|
||||
|
||||
<a class="text-white bg-black border-white outline-none sr-only focus-visible:fixed focus-visible:top-4 focus-visible:left-4 focus-visible:py-2.5 focus-visible:px-4 focus-visible:not-sr-only" href="#main">
|
||||
<?= t('aria.skipNavigation') ?>
|
||||
</a>
|
||||
12
kirby-baukasten-main/site/snippets/icon.php
Normal file
12
kirby-baukasten-main/site/snippets/icon.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Toolkit\A;
|
||||
|
||||
if (isset($type)) : ?>
|
||||
<svg <?= attr(A::merge($attr ?? [], [
|
||||
'aria-hidden' => true,
|
||||
'class' => cls($class ?? 'icon')
|
||||
])) ?>>
|
||||
<use xlink:href="<?= vite()->asset('assets/sprite.svg') ?>#<?= $type ?>"></use>
|
||||
</svg>
|
||||
<?php endif ?>
|
||||
41
kirby-baukasten-main/site/snippets/layout.php
Normal file
41
kirby-baukasten-main/site/snippets/layout.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/** @var Kirby\Cms\Page $page
|
||||
* @var Kirby\Cms\Site $site
|
||||
* @var Kirby\Cms\App $kirby */
|
||||
|
||||
if (json_decode(env('REQUIRES_LOGIN')) && !$kirby->user()) {
|
||||
go('/panel');
|
||||
} ?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= $kirby->language()?->code() ?>">
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<?php snippet('seo/head') ?>
|
||||
|
||||
<link rel="icon" href="/favicon.svg" />
|
||||
<link rel="mask-icon" href="/favicon.svg" color="#000000" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<meta name="theme-color" content="#000000">
|
||||
|
||||
<?= vite([
|
||||
'src/styles/index.css',
|
||||
'src/index.ts'
|
||||
]) ?>
|
||||
</head>
|
||||
|
||||
<body class="flex flex-col min-h-screen antialiased overflow-x-clip">
|
||||
<?php snippet('core/skip-nav') ?>
|
||||
<?php snippet('core/nav') ?>
|
||||
<main class="flex-grow">
|
||||
<div id="main"></div>
|
||||
<?= $slot ?>
|
||||
</main>
|
||||
<?php snippet('core/footer') ?>
|
||||
<?php snippet('seo/schemas') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
45
kirby-baukasten-main/site/snippets/layout.with-taxi.php
Normal file
45
kirby-baukasten-main/site/snippets/layout.with-taxi.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/** @var Kirby\Cms\Page $page
|
||||
* @var Kirby\Cms\Site $site
|
||||
* @var Kirby\Cms\App $kirby */
|
||||
|
||||
if (json_decode(env('REQUIRES_LOGIN')) && !$kirby->user()) {
|
||||
go('/panel');
|
||||
} ?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= $kirby->language()?->code() ?>">
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<?php snippet('seo/head') ?>
|
||||
|
||||
<link rel="icon" href="/favicon.svg" />
|
||||
<link rel="mask-icon" href="/favicon.svg" color="#000000" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<meta name="theme-color" content="#000000">
|
||||
|
||||
<?= vite([
|
||||
'src/styles/index.css',
|
||||
'src/index.ts'
|
||||
]) ?>
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen antialiased overflow-x-clip">
|
||||
<?php snippet('core/skip-nav') ?>
|
||||
<?php snippet('core/nav') ?>
|
||||
<div data-taxi>
|
||||
<div class="flex flex-col" data-taxi-view>
|
||||
<main class="flex-grow">
|
||||
<div id="main"></div>
|
||||
<?= $slot ?>
|
||||
</main>
|
||||
<?php snippet('core/footer') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php snippet('seo/schemas') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
18
kirby-baukasten-main/site/snippets/link.php
Normal file
18
kirby-baukasten-main/site/snippets/link.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var Kirby\Cms\StructureObject|Kirby\Content\Content $link
|
||||
*/ ?>
|
||||
|
||||
<?php if ($link->link()->isNotEmpty()) : ?>
|
||||
<a <?= attr([
|
||||
'class' => $class ?? '',
|
||||
'href' => $link->link()->toUrl(),
|
||||
'target' => $link->newTab()->toBool() ? '_blank' : null,
|
||||
'rel' => $link->newTab()->toBool() ? 'noopener' : null,
|
||||
'aria-current' => $link->link()->linkType() === 'page' && $link->link()->toPage()?->isActive() ? 'page' : null,
|
||||
...($attr ?? [])
|
||||
]) ?>>
|
||||
<?= $slot ?? $link->label()->or($link->link()->linkTitle()) ?>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
97
kirby-baukasten-main/site/snippets/picture.php
Normal file
97
kirby-baukasten-main/site/snippets/picture.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var Kirby\Cms\File|Kirby\Filesystem\Asset $image The image to display
|
||||
* @var string|null $alt An optional alt text, defaults to the file's alt text
|
||||
* @var int|null $ratio Specify a ratio for the image crop
|
||||
*
|
||||
* @var array|null $formats Which formats to render (avif, jpeg, etc.)
|
||||
* @var string|null $preset Which srcset preset to use
|
||||
* @var string|null $sizes The sizes attribute for the <img> element
|
||||
*
|
||||
* @var string|array|null $class Additional classes for the <picture> element
|
||||
* @var string|array|null $imgClass Additional classes for the <img> element
|
||||
* @var array|null $attr Additional attributes for the <picture> element
|
||||
*
|
||||
* @var bool|null $clientBlur Whether to use client-side blurhash/thumbhash, defaults to true
|
||||
* @var bool|null $lazy Whether to use lazy loading, defaults to true
|
||||
* */
|
||||
|
||||
use Kirby\Toolkit\A;
|
||||
|
||||
$focus ??= is_a($image, 'Kirby\Cms\File') ? $image?->focus() ?? 'center' : 'center';
|
||||
$ratio ??= null;
|
||||
$preset ??= 'default';
|
||||
$clientBlur ??= true;
|
||||
$attr ??= [];
|
||||
$formats ??= ['webp', $image?->extension()];
|
||||
$lazy ??= true;
|
||||
|
||||
if (is_a($image, 'Kirby\Cms\File') || is_a($image, 'Kirby\Filesystem\Asset')) : ?>
|
||||
|
||||
<picture <?= attr([
|
||||
'class' => ['block', $class ?? ''],
|
||||
'style' => '--ratio: ' . ($ratio ?? round($image->ratio(), 2)) . ';',
|
||||
...$attr
|
||||
]) ?>>
|
||||
|
||||
<?php if ($image->extension() == 'svg') : ?>
|
||||
<?= svg($image) ?>
|
||||
<?php else : ?>
|
||||
|
||||
<?php foreach ($formats as $format) :
|
||||
$widths = option("thumbs.srcsets.{$preset}");
|
||||
$srcset = [];
|
||||
$median = $ratio ? $image->crop(median($widths), floor(median($widths) / $ratio)) : $image->resize(median($widths)); ?>
|
||||
|
||||
<?php
|
||||
// Generate srcset array
|
||||
foreach ($widths as $width) {
|
||||
$srcset[$width . 'w'] = [
|
||||
'width' => $width,
|
||||
'height' => $ratio ? floor($width / $ratio) : null,
|
||||
'crop' => $ratio ? true : false,
|
||||
'format' => $format
|
||||
];
|
||||
} ?>
|
||||
|
||||
<?php if ($lazy) : ?>
|
||||
<source <?= attr([
|
||||
'type' => "image/{$format}",
|
||||
'data-srcset' => $image->srcset($srcset),
|
||||
'data-sizes' => $sizes ?? 'auto',
|
||||
]) ?>>
|
||||
<?php else : ?>
|
||||
<source <?= attr([
|
||||
'type' => "image/{$format}",
|
||||
'srcset' => $image->srcset($srcset),
|
||||
'sizes' => $sizes ?? '100vw'
|
||||
]) ?>>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<img <?= attr([
|
||||
'data-thumbhash' => $clientBlur ? $image->th() : null,
|
||||
'src' => !$clientBlur ? $image->thUri() : null,
|
||||
'data-src' => $median->url(),
|
||||
'width' => $image->width(),
|
||||
'height' => $ratio ? floor($image->width() / $ratio) : $image->height(),
|
||||
'alt' => $alt ?? (is_a($image, 'Kirby\Cms\File') ? $image->alt() : null),
|
||||
'loading' => $lazy ? "lazy" : null,
|
||||
'data-sizes' => $sizes ?? 'auto',
|
||||
'class' => cls(['size-full object-cover', $imgClass ?? ' ']),
|
||||
'style' => A::join([
|
||||
"aspect-ratio: " . ($ratio ?? $image->ratio()),
|
||||
"object-position: {$focus}"
|
||||
], '; '),
|
||||
]) ?>>
|
||||
|
||||
|
||||
<?php endif ?>
|
||||
</picture>
|
||||
|
||||
<?php
|
||||
// Dummy element that will be rendered when specified image is not an image
|
||||
else : ?>
|
||||
<picture <?= attr(['class' => ['block', $class ?? ''], ...$attr]) ?>></picture>
|
||||
<?php endif ?>
|
||||
Reference in New Issue
Block a user