Skip to content

Commit f4463cc

Browse files
authored
feat(app): add layout html tags (#368)
* feat(app): add layout html tags * refactor(app): remove title attributes * refactor(app): remove key attribute * feat(app): add head for index page * feat(app): add example page * refactor(app): move common html tags into DefaultTags component * refactor(app): change component name and move to components folder
1 parent e0cdc3c commit f4463cc

File tree

8 files changed

+38
-1
lines changed

8 files changed

+38
-1
lines changed

apps/app/app/foo/head.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { HeadTags } from "../../components/HeadTags";
2+
3+
export default function Head() {
4+
return (
5+
<>
6+
<HeadTags title="foo" />
7+
</>
8+
);
9+
}

apps/app/app/foo/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function FooPage() {
2+
return <div>siema</div>;
3+
}

apps/app/app/head.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { HeadTags } from "../components/HeadTags";
2+
3+
export default function Head() {
4+
return (
5+
<>
6+
<HeadTags title="Strona główna" />
7+
</>
8+
);
9+
}

apps/app/app/layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import "./globals.css";
55
export default function RootLayout({ children }: { children: React.ReactNode }) {
66
return (
77
<html lang="pl">
8-
<head></head>
98
<body>
109
{children}
1110
<AnalyticsWrapper />

apps/app/app/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Link from "next/link";
2+
13
export default function Page() {
24
return (
35
<div className="m-2 p-2">
@@ -7,6 +9,7 @@ export default function Page() {
79
<li>NEXT_PUBLIC_API_URL: {process.env.NEXT_PUBLIC_API_URL}</li>
810
<li>NEXT_PUBLIC_APP_URL: {process.env.NEXT_PUBLIC_APP_URL}</li>
911
</ul>
12+
<Link href="/foo">foo</Link>
1013
</div>
1114
);
1215
}

apps/app/components/HeadTags.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
type DefaultHeadTags = Readonly<{
2+
title?: string;
3+
description?: string;
4+
}>;
5+
6+
export const HeadTags = ({ title = "", description = "" }: DefaultHeadTags) => (
7+
<>
8+
<title>{`DevFAQ.pl • ${title}`}</title>
9+
<meta name="description" content={description} />
10+
<meta name="viewport" content="width=device-width, initial-scale=1" />
11+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
12+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
13+
</>
14+
);

apps/app/public/favicon-16x16.png

438 Bytes
Loading

apps/app/public/favicon-32x32.png

506 Bytes
Loading

0 commit comments

Comments
 (0)