Skip to content

Commit

Permalink
Complete header other than search
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed Dec 26, 2023
1 parent ee0d0ba commit 4cbd053
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 16 deletions.
12 changes: 8 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Metadata } from "next";
import { Code } from "@nextui-org/react";
import { Button } from "@nextui-org/react";
import { Button, Link } from "@nextui-org/react";
import NextLink from "next/link";
import { faDownload, faArrowRight } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { WindowActions } from "~/components/WindowActions";

export const metadata: Metadata = {
title: "Poac - Intuitive and fast C++ package manager and build system",
Expand Down Expand Up @@ -33,7 +34,8 @@ export default function Home() {
</h2>
<div>
<Button
as={NextLink}
isExternal
as={Link}
className="w-full md:w-auto"
color="primary"
href="https://github.com/poac-dev/poac#installation"
Expand All @@ -49,7 +51,8 @@ export default function Home() {
Install Poac
</Button>
<Button
as={NextLink}
isExternal
as={Link}
className="mx-0 my-4 md:mx-4 md:my-0 w-full md:w-auto"
href="https://doc.poac.dev/guide"
radius="full"
Expand All @@ -66,7 +69,8 @@ export default function Home() {
</div>
</div>
<div className="relative">
<Code className="text-md max-[600px]:text-xs">
<WindowActions title="Terminal" />
<Code className="text-md max-[600px]:text-xs shadow-medium p-4" style={{ backgroundColor: '#0D0B0B' }}>
$ <span style={{ color: green }}>poac</span> new
hello_world
<br />
Expand Down
49 changes: 37 additions & 12 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ import {
NavbarContent,
NavbarItem,
Link,
Button,
} from "@nextui-org/react";
import NextLink from "next/link";
import { faGithub } from "@fortawesome/free-brands-svg-icons";
import {
faBookOpen,
faHeart,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

import { Logo } from "./Logo";

Expand All @@ -20,29 +27,47 @@ export default function Header(): JSX.Element {
</dev>
</NextLink>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarContent justify="center">
<NavbarItem>
<Link color="foreground" href="https://doc.poac.dev">
Docs
</Link>
<Link href="/search">Browse all packages</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent className="hidden sm:flex gap-4" justify="end">
<NavbarItem>
<Link color="foreground" href="https://github.com/poac-dev">
GitHub
<Link
isExternal
aria-label="Docs"
className="p-1 text-default-600 dark:text-default-500"
href="https://doc.poac.dev"
>
<FontAwesomeIcon className="text-default-600 dark:text-default-500" icon={faBookOpen} width={20} />
&nbsp;
Docs
</Link>
</NavbarItem>
<NavbarItem>
<Link
color="foreground"
href="https://github.com/sponsors/ken-matsui"
isExternal
aria-label="Github"
className="p-1"
href="https://github.com/poac-dev"
>
Sponsor
<FontAwesomeIcon className="text-default-600 dark:text-default-500" icon={faGithub} width={20} />
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem>
<Link href="/search">Browse all packages</Link>
<Button
isExternal
as={Link}
className="group text-sm font-normal text-default-600 bg-default-400/20 dark:bg-default-500/20"
href="https://github.com/sponsors/ken-matsui"
startContent={
<FontAwesomeIcon className="text-danger" icon={faHeart} width={15} />
}
variant="flat"
>
Sponsor
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
Expand Down
68 changes: 68 additions & 0 deletions components/WindowActions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// This code is based on the original code found at Next UI.
// https://github.com/nextui-org/nextui/blob/132efbcb6d3828ec7aab2cb2d0c79db3868dee92/apps/docs/components/code-window/window-actions.tsx
// Modifications have been made to fit the specific needs of this project.
/*
MIT License
Copyright (c) 2020 Next UI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

import React from "react";
import { tv } from "tailwind-variants";
import { clsx } from "@nextui-org/shared-utils";

export type WindowActionsProps = {
title?: string;
className?: string;
};

const windowIconStyles = tv({
base: "w-3 h-3 rounded-full",
variants: {
color: {
red: "bg-red-500",
yellow: "bg-yellow-500",
green: "bg-green-500",
},
},
});

export const WindowActions: React.FC<WindowActionsProps> = ({ title, className, ...props }) => {
return (
<div
className={clsx(
"flex items-center sticky top-0 left-0 px-4 z-10 justify-between h-8 bg-code-background w-full",
className,
)}
{...props}
>
<div className="flex items-center gap-2 basis-1/3">
<div className={windowIconStyles({ color: "red" })} />
<div className={windowIconStyles({ color: "yellow" })} />
<div className={windowIconStyles({ color: "green" })} />
</div>
<div className="flex basis-1/3 h-full justify-center items-center">
{title && <p className="text-white/30 text-sm">{title}</p>}
</div>
<div className="flex basis-1/3" />
</div>
);
};

0 comments on commit 4cbd053

Please sign in to comment.