Offers, tabelka z uslugami
This commit is contained in:
@@ -3,6 +3,7 @@ import DefaultLayout from "../../layouts/DefaultLayout.astro";
|
||||
import Hero from "../../components/hero/Hero.astro";
|
||||
import SectionRenderer from "../../components/sections/SectionRenderer.astro";
|
||||
import Markdown from "../../islands/Markdown.jsx";
|
||||
import OffersIsland from "../../islands/OffersIsland.jsx";
|
||||
|
||||
import yaml from "js-yaml";
|
||||
import fs from "fs";
|
||||
@@ -17,7 +18,16 @@ const page = yaml.load(
|
||||
fs.readFileSync("./src/content/internet-swiatlowodowy/page.yaml", "utf8"),
|
||||
);
|
||||
|
||||
type Paragraph = {
|
||||
title?: string;
|
||||
content: string;
|
||||
};
|
||||
|
||||
const data = yaml.load(
|
||||
fs.readFileSync("./src/content/internet-swiatlowodowy/offers.yaml", "utf8"),
|
||||
);
|
||||
const first = page.paragraphs[0];
|
||||
const rest = page.paragraphs.slice(1);
|
||||
---
|
||||
|
||||
<DefaultLayout seo={seo}>
|
||||
@@ -26,28 +36,21 @@ const first = page.paragraphs[0];
|
||||
<section class="fuz-section text-center">
|
||||
<div class="fuz-section-grid md:grid-cols-1">
|
||||
{page.title.map((line: any) => <h1 class="fuz-section-title">{line}</h1>)}
|
||||
|
||||
{first.title && <h3>{first.title}</h3>}
|
||||
<Markdown text={first.content} />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{
|
||||
page.paragraphs.slice(1).map((p: { title: string; content: string }) => (
|
||||
<section class="fuz-section text-center">
|
||||
<div class="fuz-section-grid md:grid-cols-1">
|
||||
{p.title && <h3 class="fuz-section-title">{p.title}</h3>}
|
||||
<OffersIsland client:load data={data} />
|
||||
|
||||
{p.content
|
||||
.trim()
|
||||
.split(/\n\n+/)
|
||||
.map((par: string) => (
|
||||
<Markdown text={par} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
))
|
||||
}
|
||||
{rest.map((p: Paragraph) => (
|
||||
<section class="fuz-section text-center">
|
||||
<div class="fuz-section-grid md:grid-cols-1">
|
||||
{p.title && <h3 class="fuz-section-title">{p.title}</h3>}
|
||||
<Markdown text={p.content.replace(/\n/g, "\n\n")} />
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
|
||||
<SectionRenderer src="./src/content/internet-swiatlowodowy/section.yaml" />
|
||||
<!-- <section class="fuz-section">
|
||||
|
||||
Reference in New Issue
Block a user