File size: 1,522 Bytes
085e9e0
aa651ae
1a805b3
aa651ae
 
 
085e9e0
 
 
aa651ae
 
085e9e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aa651ae
085e9e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aa651ae
085e9e0
 
aa651ae
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use client';
import "./Header.css";
import Link from "next/link";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faSearch } from "@fortawesome/free-solid-svg-icons";
import Image from "next/image";
import { useEffect } from "react";
import { usePathname } from "next/navigation";
import Sidebar from "@/components/Sidebar";

const Header = () => {
  const pathname = usePathname();
  const isPlayerPage =
    pathname.startsWith("/player/movie") ||
    pathname.startsWith("/player/tvshow");

  useEffect(() => {
    const appContainer = document.querySelector('.app-container');
    if (appContainer) {
      if (isPlayerPage) {
        appContainer.classList.add('no-padding');
      } else {
        appContainer.classList.remove('no-padding');
      }
    }
  }, [isPlayerPage]);

  return (
    <>
      {!isPlayerPage && (
        <div className="header-container">
          <Sidebar />
          <div className="header-right">
            <div className="header-logo-container">
              <h1 className="header-title">Nexora</h1>
              <Image
                className="header-logo"
                src="/android-chrome-192x192.png"
                width={60}
                height={60}
                alt="Nexora Logo"
              />
            </div>
          </div>
          <Link href="/search" className="search-button">
            <FontAwesomeIcon icon={faSearch} size="xl" />
          </Link>
        </div>
      )}
    </>
  );
};

export default Header;