Skip to content

Commit

Permalink
Refactor Layout.astro to add footer component and container div
Browse files Browse the repository at this point in the history
  • Loading branch information
Adammatthiesen committed Dec 24, 2024
1 parent 69e6b91 commit 7a886f1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
7 changes: 6 additions & 1 deletion packages/studiocms_dashboard/src/components/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Props = {
lang?: string;
sidebar?: false | 'single' | 'double';
requiredPermission?: 'owner' | 'admin' | 'editor' | 'visitor' | 'unknown' | 'none';
footer?: boolean;
};
const {
Expand All @@ -27,6 +28,7 @@ const {
lang = 'en-us',
requiredPermission = 'unknown',
sidebar = 'single',
footer = true,
} = Astro.props;
const title = makePageTitle(propTitle, dbConfig);
Expand Down Expand Up @@ -56,10 +58,13 @@ const description = propDescription ?? dbConfig.description;
</Button>
)}
<div class="container">
<div class="page-header">
<slot name="header" />
</div>
<slot />
</div>

<Footer />
{ footer && <Footer /> }
</main>
</body>
</html>
1 change: 1 addition & 0 deletions packages/studiocms_dashboard/src/routes/404.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Layout } from '../components';
title="Error 404"
description="Error 404 - Page not found"
sidebar={false}
footer={false}
requiredPermission="none">
<div class="notfound-container">
<div class="notfound">
Expand Down
16 changes: 9 additions & 7 deletions packages/studiocms_dashboard/src/routes/configuration.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ const lang = 'en-us';
{pagePreRendered}
{lang}
>

<PageHeader title="Site Configuration">
<Button variant="solid" color="primary" type="submit" form="site-config-form">
<Icon slot="start-content" name="check" width={24} height={24} />
Save Changes
</Button>
</PageHeader>

<div slot="header">
<PageHeader title="Site Configuration">
<Button variant="solid" color="primary" type="submit" form="site-config-form">
<Icon slot="start-content" name="check" width={24} height={24} />
Save Changes
</Button>
</PageHeader>
</div>

{
pagePreRendered
? <ConfigForm server:defer transition:persist transition:persist-props />
Expand Down
8 changes: 6 additions & 2 deletions packages/studiocms_dashboard/src/routes/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ const t = useTranslations(lang, '@studiocms/dashboard:index');
{lang}
>

<DashboardPageHeader {pagePreRendered} />
<span>{t('sub-header')}</span>
<div slot="header">
<DashboardPageHeader {pagePreRendered} />
<span>{t('sub-header')}</span>
</div>



</Layout>
6 changes: 4 additions & 2 deletions packages/studiocms_dashboard/src/routes/profile.astro
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ const shouldShowOAuth = showOAuth && providerData.some(({ enabled }) => enabled)
{pagePreRendered}
{lang}
>

<PageHeader title="Your Profile" />

<div slot="header">
<PageHeader title="Your Profile" />
</div>

<div class="page-content">

Expand Down
4 changes: 4 additions & 0 deletions packages/studiocms_dashboard/src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,7 @@ main {
height: 100%;
min-height: 90vh;
}

.container .page-header {
margin-bottom: 1.5rem;
}

0 comments on commit 7a886f1

Please sign in to comment.