mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 20:15:27 +00:00
feat: add page layout and grid layout
This commit is contained in:
@@ -51,7 +51,7 @@ const { title, backLink } = Astro.props;
|
|||||||
<ThemeProvider />
|
<ThemeProvider />
|
||||||
</head>
|
</head>
|
||||||
<body
|
<body
|
||||||
class="flex h-screen flex-col bg-shibui-100 font-sans font-normal leading-relaxed text-shibui-950 common-ligatures discretionary-ligatures dark:bg-shibui-900 dark:text-shibui-200/[0.87]"
|
class="flex h-screen flex-col bg-shibui-100 font-sans font-normal leading-relaxed text-shibui-950 common-ligatures dark:bg-shibui-900 dark:text-shibui-200/[0.87]"
|
||||||
>
|
>
|
||||||
<Sprite.Provider>
|
<Sprite.Provider>
|
||||||
<PageHeader backLink={backLink} />
|
<PageHeader backLink={backLink} />
|
||||||
|
|||||||
28
src/layouts/GridLayout.astro
Normal file
28
src/layouts/GridLayout.astro
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
import cx from 'classnames';
|
||||||
|
|
||||||
|
import BaseLayout from './BaseLayout.astro';
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
class?: string;
|
||||||
|
grid?: 'wide' | 'narrow';
|
||||||
|
}
|
||||||
|
|
||||||
|
const { frontmatter, class: className, grid = 'wide' } = Astro.props;
|
||||||
|
const gridVariant = frontmatter.grid || grid;
|
||||||
|
|
||||||
|
const gridClasses = cx('grid w-full grid-cols-18', className);
|
||||||
|
const wrapperClasses = cx(
|
||||||
|
'col-start-2 col-end-18',
|
||||||
|
{ 'md:col-start-6 md:col-end-14 xl:col-start-7 xl:col-end-13': gridVariant === 'narrow' },
|
||||||
|
{ 'md:col-start-3 md:col-end-16': gridVariant === 'wide' }
|
||||||
|
);
|
||||||
|
---
|
||||||
|
|
||||||
|
<BaseLayout title={frontmatter.title}>
|
||||||
|
<div class={gridClasses}>
|
||||||
|
<div class={wrapperClasses}>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</BaseLayout>
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
---
|
---
|
||||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
|
||||||
import { Title } from '../components/Title';
|
import { Title } from '../components/Title';
|
||||||
|
|
||||||
const { frontmatter } = Astro.props;
|
import GridLayout from './GridLayout.astro';
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
class?: string;
|
||||||
|
grid?: 'wide' | 'narrow';
|
||||||
|
}
|
||||||
|
|
||||||
|
const { frontmatter, class: className, grid = 'wide' } = Astro.props;
|
||||||
|
const gridVariant = frontmatter.grid || grid;
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout title={frontmatter.title}>
|
<GridLayout grid={gridVariant} class={className} {frontmatter}>
|
||||||
<Title>{frontmatter.title}</Title>
|
<Title>{frontmatter.title}</Title>
|
||||||
<slot />
|
<slot />
|
||||||
</BaseLayout>
|
</GridLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user