Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import NavBar from "../components/NavBar";
import "./globals.css";

const geistSans = Geist({
Expand Down Expand Up @@ -27,6 +28,7 @@ export default function RootLayout({
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<NavBar />
{children}
</body>
</html>
Expand Down
20 changes: 20 additions & 0 deletions components/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Link from "next/link";

export default function NavBar() {
return (
<nav className="p-4 border-b">
<div className="flex justify-between">
<Link href="/" className="hover:underline">
Home
</Link>
<Link
href="https://nextjs.org/docs"
target="_blank"
className="hover:underline"
>
Next.js Docs
</Link>
Comment on lines +10 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add rel="noopener noreferrer" to the external link for security.

When using target="_blank" for external links, it's recommended to include rel="noopener noreferrer" to prevent potential security vulnerabilities (tab nabbing). This helps protect your users by ensuring the new page can't access your window object through window.opener.

<Link
  href="https://nextjs.org/docs"
  target="_blank"
+ rel="noopener noreferrer"
  className="hover:underline"
>
  Next.js Docs
</Link>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Link
href="https://nextjs.org/docs"
target="_blank"
className="hover:underline"
>
Next.js Docs
</Link>
<Link
href="https://nextjs.org/docs"
target="_blank"
rel="noopener noreferrer"
className="hover:underline"
>
Next.js Docs
</Link>

</div>
</nav>
);
}
8 changes: 8 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./app/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};