mirror of
https://github.com/Unkn0wnCat/KevinK.dev.js.git
synced 2025-06-06 20:52:01 +02:00
Port to TypeScript
This commit is contained in:
parent
01d3014e2f
commit
bc429f5d69
32 changed files with 419 additions and 105 deletions
|
@ -1,69 +0,0 @@
|
|||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import Navigation from "../components/navigation";
|
||||
import SEO from "../components/seo";
|
||||
|
||||
import "./default.scss";
|
||||
import { Link, Trans } from "gatsby-plugin-react-i18next";
|
||||
import LanguageSwitcher from "../components/languageSwitcher";
|
||||
|
||||
class Layout extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<SEO
|
||||
description={this.props.description}
|
||||
lang={this.props.lang}
|
||||
meta={this.props.meta}
|
||||
title={this.props.title}
|
||||
image={this.props.image}
|
||||
speakable={this.props.speakable}
|
||||
>
|
||||
{this.props.seoAdditional ?? null}
|
||||
</SEO>
|
||||
<Navigation isHome={this.props.transparentTopbar} />
|
||||
<div id="content" role="main">
|
||||
{this.props.children}
|
||||
</div>
|
||||
<footer role="contentinfo">
|
||||
CC-BY 4.0 Kevin Kandlbinder,{" "}
|
||||
<Link to="/legal/about" className="spf-link">
|
||||
<Trans i18nKey="layout.imprint">Imprint</Trans>
|
||||
</Link>{" "}
|
||||
|{" "}
|
||||
<Link to="/legal/datasec" className="spf-link">
|
||||
<Trans i18nKey="layout.datasec">Data Protection</Trans>
|
||||
</Link>{" "}
|
||||
|{" "}
|
||||
<Link to="/legal/disclaimer" className="spf-link">
|
||||
<Trans i18nKey="layout.disclaimer">Disclaimer</Trans>
|
||||
</Link>{" "}
|
||||
| <a href="#languageChooser">Language</a>
|
||||
</footer>
|
||||
|
||||
<LanguageSwitcher />
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Layout.defaultProps = {
|
||||
module: `none`,
|
||||
meta: [],
|
||||
description: ``,
|
||||
transparentTopbar: false,
|
||||
};
|
||||
|
||||
Layout.propTypes = {
|
||||
description: PropTypes.string,
|
||||
lang: PropTypes.string,
|
||||
meta: PropTypes.arrayOf(PropTypes.object),
|
||||
title: PropTypes.string.isRequired,
|
||||
transparentTopbar: PropTypes.bool,
|
||||
children: PropTypes.any.isRequired,
|
||||
seoAdditional: PropTypes.any,
|
||||
image: PropTypes.string,
|
||||
speakable: PropTypes.any,
|
||||
};
|
||||
|
||||
export default Layout;
|
6
src/layouts/default.scss.d.ts
vendored
Normal file
6
src/layouts/default.scss.d.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
export const content: string;
|
||||
export const flexSpacer: string;
|
||||
export const gatsby: string;
|
||||
export const gatsbyFocusWrapper: string;
|
||||
export const profile: string;
|
||||
export const section: string;
|
62
src/layouts/default.tsx
Normal file
62
src/layouts/default.tsx
Normal file
|
@ -0,0 +1,62 @@
|
|||
import React from "react";
|
||||
import Navigation from "../components/navigation";
|
||||
import SEO from "../components/seo";
|
||||
import "./default.scss";
|
||||
import { Link, Trans } from "gatsby-plugin-react-i18next";
|
||||
import LanguageSwitcher from "../components/languageSwitcher";
|
||||
|
||||
type LayoutProps = {
|
||||
description?: string,
|
||||
meta?: any[],
|
||||
title: string,
|
||||
transparentTopbar?: boolean,
|
||||
seoAdditional?: any,
|
||||
image?: string,
|
||||
speakable?: any
|
||||
}
|
||||
|
||||
const Layout = ({description, meta, title, image, speakable, seoAdditional, transparentTopbar, children}: React.PropsWithChildren<LayoutProps>) => {
|
||||
return (
|
||||
<>
|
||||
<SEO
|
||||
description={description}
|
||||
meta={meta}
|
||||
title={title}
|
||||
image={image}
|
||||
speakable={speakable}
|
||||
>
|
||||
{seoAdditional ?? null}
|
||||
</SEO>
|
||||
<Navigation isHome={transparentTopbar} />
|
||||
<div id="content" role="main">
|
||||
{children}
|
||||
</div>
|
||||
<footer role="contentinfo">
|
||||
CC-BY 4.0 Kevin Kandlbinder,{" "}
|
||||
<Link to="/legal/about" className="spf-link">
|
||||
<Trans i18nKey="layout.imprint">Imprint</Trans>
|
||||
</Link>{" "}
|
||||
|{" "}
|
||||
<Link to="/legal/datasec" className="spf-link">
|
||||
<Trans i18nKey="layout.datasec">Data Protection</Trans>
|
||||
</Link>{" "}
|
||||
|{" "}
|
||||
<Link to="/legal/disclaimer" className="spf-link">
|
||||
<Trans i18nKey="layout.disclaimer">Disclaimer</Trans>
|
||||
</Link>{" "}
|
||||
| <a href="#languageChooser">Language</a>
|
||||
</footer>
|
||||
|
||||
<LanguageSwitcher />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Layout.defaultProps = {
|
||||
module: `none`,
|
||||
meta: [],
|
||||
description: ``,
|
||||
transparentTopbar: false,
|
||||
};
|
||||
|
||||
export default Layout;
|
Loading…
Add table
Add a link
Reference in a new issue