Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-unique key warning in slider #6

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
63 changes: 37 additions & 26 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
import React from "react";
import React, { useEffect, useState } from "react";
import Link from 'next/link';
import { useRouter } from 'next/router'; // Import useRouter
import { motion } from "framer-motion";
import { IoIosGlobe, IoMdSearch, IoMdPerson } from "react-icons/io";
import Head from "next/head";

function Header() {
const [active, setActive] = React.useState(0);
const router = useRouter(); // Use the useRouter hook
const [active, setActive] = useState('');

useEffect(() => {
// Convert the current pathname to the format used in the menus array
// '/feedback' will become 'Feedback'
const path = router.pathname === '/' ? 'Home' : router.pathname.substring(1);
setActive(path.charAt(0).toUpperCase() + path.slice(1).replace('-', ' '));
}, [router.pathname]); // Run this effect when the pathname changes

return (
<div className=" absolute mt-5 flex w-full flex-wrap items-center justify-between gap-2 px-5 text-xs font-medium uppercase opacity-90 md:px-10">
<div className="absolute mt-5 flex w-full flex-wrap items-center justify-between gap-2 px-5 text-xs font-medium uppercase opacity-90 md:px-10">
<Head>
<title>Cool Project</title>
<title>AC Code SEA</title>
</Head>
<div className=" flex items-center gap-2 font-medium tracking-[4px]">
<IoIosGlobe className=" text-xl" />
Trust me
<div className="flex items-center gap-2 font-medium tracking-[4px]">
<IoIosGlobe className="text-xl" />
Assassin's Creed Code SEA
</div>
<ul className=" flex flex-wrap items-center gap-3 text-[11px] md:gap-10">
{menus.map((menu, index) => {
<ul className="flex flex-wrap items-center gap-3 text-[11px] md:gap-10">
{menus.map((menu) => {
const path = menu.toLowerCase().replace(/\s+/g, '-');
return (
<motion.li
layout
key={index}
className={` ${
active == index && " border-b-2 border-b-yellow-500"
} inline-block cursor-pointer border-b-yellow-500 transition duration-300 ease-in-out hover:border-b-2 hover:text-white`}
>
{menu}
</motion.li>
<Link href={path === 'home' ? '/' : `/${path}`} key={menu}>
<motion.li
layout
className={`${active === menu ? "border-b-2 border-b-yellow-500" : ""} inline-block cursor-pointer transition duration-300 ease-in-out hover:border-b-2 hover:text-white`}
>
{menu}
</motion.li>
</Link>
);
})}
<div className=" flex items-center gap-6">
<IoMdSearch className=" text-lg" />
<IoMdPerson className=" text-lg" />
<div className="flex items-center gap-6">
<IoMdSearch className="text-lg" />
<IoMdPerson className="text-lg" />
</div>
</ul>
</div>
Expand All @@ -41,9 +52,9 @@ export default Header;

const menus = [
"Home",
"Holdidays",
"Destinations",
"Flights",
"Offers",
"Contacts",
"Feedback",
"View Feedback",
"Storyline",
"Join the team (OTW)",
"Contacts (OTW)",
];
2 changes: 1 addition & 1 deletion components/SlideInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function SlideInfo({ transitionData, currentSlideData }: Props) {
className=" w-fit rounded-full border-[1px] border-[#ffffff8f] px-6 py-3 text-[10px] font-thin transition duration-300
ease-in-out hover:bg-white hover:text-black "
>
DISCOVER LOCATION
DISCOVER GAME
</button>
</motion.div>
</>
Expand Down
Binary file added feedback.db
Binary file not shown.
12 changes: 12 additions & 0 deletions lib/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// /lib/database.js
const { Pool } = require('pg');

// Create a connection pool using the DATABASE_URL environment variable
const pool = new Pool({
connectionString: process.env.DATABASE_URL, // This uses the DATABASE_URL you set on Vercel
ssl: {
rejectUnauthorized: false, // Required for cloud-based database connections like Supabase
},
});

module.exports = pool;
Loading