Storybook: Kód
Paragraf Code: jazyk, styl, čísla řádků
Storybook · demo
PHP, čísla řádků, styl solarized
Hook v OOP stylu
<?php
declare(strict_types=1);
namespace Drupal\vmhub_core\Hook;
use Drupal\Core\Hook\Attribute\Hook;
final class Example {
#[Hook('node_presave')]
public function presave(NodeInterface $node): void {
$node->setTitle(trim($node->getTitle()));
}
}TypeScript, styl dark
export const revalidate = async (tags: string[]) => {
for (const tag of tags) {
revalidateTag(tag);
}
};YAML bez čísel řádků
name: 'VMHub Content: Demo'
type: Content
install:
- vmhub_content
- vmhub_siteShell, zarovnání na střed
docker compose exec -T php drush cr
docker compose exec -T php composer drupal:content:demoCSS, styl solarized
.hero {
min-height: 60vh;
color: var(--vm-primary);
}Diff, styl dark
--- a/recipe.yml
+++ b/recipe.yml
@@ -1,3 +1,4 @@
name: 'VMHub Content: Demo'
type: Content
+description: 'Demo site and storybook'
install:Dockerfile, bez stylu
FROM php:8.5-fpm-alpine
RUN apk add --no-cache poppler-utils
COPY . /var/www
WORKDIR /var/wwwHTML, styl solarized
<section class="hero">
<h1>Storybook</h1>
<a class="button" href="/storybook">Open</a>
</section>JavaScript, styl dark
document.querySelectorAll('[data-countdown-target]').forEach((el) => {
const target = new Date(el.dataset.countdownTarget);
console.log(target.toISOString());
});JSON, bez stylu
{
"site": "demo",
"languages": ["cs", "en", "de"],
"storybook": true
}Markdown, styl solarized
# Storybook
- **Layouts**: rows and columns
- *Text*: rich text
[Drupal](https://www.drupal.org)Python, styl dark
def det_uuid(key):
u = uuid.uuid5(uuid.NAMESPACE_URL, key)
return str(u)SQL, bez stylu
SELECT nid, title
FROM node_field_data
WHERE status = 1
ORDER BY created DESC
LIMIT 10;Twig, styl solarized
{% for item in items %}
<li>{{ item.title|upper }}</li>
{% endfor %}