Skip to content

Commit 166cad8

Browse files
authored
chore: github button in navbar (#1101)
* add github button * cleanup * type
1 parent 5c4d36b commit 166cad8

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

apps/web/app/(site)/Navbar.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import {
44
Button,
5-
ListItem,
65
Logo,
76
NavigationMenu,
87
NavigationMenuContent,
@@ -15,6 +14,7 @@ import {
1514
import { classNames } from "@cap/utils";
1615
import { Clapperboard, Zap } from "lucide-react";
1716
import { motion } from "motion/react";
17+
import Image from "next/image";
1818
import Link from "next/link";
1919
import { usePathname } from "next/navigation";
2020
import { Suspense, use, useEffect, useState } from "react";
@@ -131,8 +131,8 @@ export const Navbar = () => {
131131

132132
return (
133133
<>
134-
<header className="fixed top-4 left-0 right-0 z-[51] md:top-10 animate-in fade-in slide-in-from-top-4 duration-500">
135-
<nav className="p-2 mx-auto w-full max-w-[calc(100%-20px)] bg-white rounded-full border backdrop-blur-md md:max-w-fit border-zinc-200 h-fit">
134+
<header className="fixed top-4 left-0 right-0 z-[51] lg:top-10 animate-in fade-in slide-in-from-top-4 duration-500">
135+
<nav className="p-2 mx-auto w-full max-w-[calc(100%-20px)] bg-white rounded-full border backdrop-blur-md lg:max-w-fit border-zinc-200 h-fit">
136136
<div className="flex gap-12 justify-between items-center mx-auto max-w-4xl h-full transition-all">
137137
<div className="flex items-center">
138138
<Link passHref href="/home">
@@ -146,7 +146,7 @@ export const Navbar = () => {
146146
}}
147147
/>
148148
</Link>
149-
<div className="hidden md:flex">
149+
<div className="hidden lg:flex">
150150
<NavigationMenu>
151151
<NavigationMenuList className="space-x-0">
152152
{Links.map((link) => (
@@ -169,9 +169,9 @@ export const Navbar = () => {
169169
href={sublink.href}
170170
className="block p-3 space-y-1 leading-none no-underline rounded-md transition-all duration-200 outline-none select-none hover:bg-gray-2 hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
171171
>
172-
<div className="flex items-center gap-2 text-base font-medium leading-none transition-colors duration-200 text-zinc-700 group-hover:text-zinc-900">
172+
<div className="flex gap-2 items-center text-base font-medium leading-none transition-colors duration-200 text-zinc-700 group-hover:text-zinc-900">
173173
{sublink.icon && sublink.icon}
174-
<span className="text-gray-12 font-semibold">
174+
<span className="font-semibold text-gray-12">
175175
{sublink.label}
176176
</span>
177177
</div>
@@ -206,7 +206,24 @@ export const Navbar = () => {
206206
</NavigationMenu>
207207
</div>
208208
</div>
209-
<div className="hidden items-center space-x-2 md:flex">
209+
<div className="hidden items-center space-x-2 lg:flex">
210+
<Button
211+
variant="outline"
212+
icon={
213+
<Image
214+
src="/github.svg"
215+
alt="Github"
216+
width={16}
217+
height={16}
218+
/>
219+
}
220+
target="_blank"
221+
href="https://github.com/CapSoftware/Cap"
222+
size="sm"
223+
className="w-full font-medium sm:w-auto"
224+
>
225+
Github
226+
</Button>
210227
<Suspense
211228
fallback={
212229
<Button
@@ -234,7 +251,7 @@ export const Navbar = () => {
234251
</div>
235252
<button
236253
type="button"
237-
className="flex md:hidden"
254+
className="flex lg:hidden"
238255
onClick={() => setShowMobileMenu(!showMobileMenu)}
239256
>
240257
<div className="flex flex-col gap-[5px] mr-1">

apps/web/components/ui/MobileMenu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ const externalLinks: NavLink[] = [
5656
];
5757

5858
const MobileMenu: React.FC<MobileMenuProps> = ({ setShowMobileMenu, auth }) => {
59-
console.log(auth, "auth");
6059
return (
61-
<div className="block overflow-auto fixed top-0 left-0 z-40 px-4 w-full h-full bg-gray-2 md:hidden">
60+
<div className="block overflow-auto fixed top-0 left-0 z-40 px-4 w-full h-full bg-gray-2">
6261
<div className="pb-12">
6362
<nav className="relative mt-24 mobile">
6463
<ul className="p-0 space-y-4">

apps/web/public/github.svg

Lines changed: 1 addition & 0 deletions
Loading

packages/ui/src/components/Button.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const buttonVariants = cva(
1919
destructive:
2020
"bg-red-500 text-white hover:bg-red-600 disabled:bg-red-200",
2121
outline:
22-
"border border-gray-4 hover:border-gray-12 hover:bg-gray-12 hover:text-gray-1 text-gray-12 disabled:bg-gray-8",
22+
"border border-gray-4 hover:border-gray-5 hover:bg-gray-3 text-gray-12 disabled:bg-gray-8",
2323
white:
2424
"bg-gray-1 border border-gray-5 text-gray-12 hover:bg-gray-3 disabled:bg-gray-8",
2525
ghost: "hover:bg-white/20 hover:text-white",
@@ -49,6 +49,7 @@ export interface ButtonProps
4949
href?: string;
5050
kbd?: string;
5151
icon?: React.ReactNode;
52+
target?: string;
5253
}
5354

5455
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
@@ -62,6 +63,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
6263
href,
6364
kbd,
6465
icon,
66+
target,
6567
...props
6668
},
6769
ref,
@@ -71,6 +73,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
7173
<Comp
7274
className={classNames(buttonVariants({ variant, size, className }))}
7375
ref={ref as any}
76+
target={target || undefined}
7477
href={href || undefined}
7578
{...props}
7679
>

0 commit comments

Comments
 (0)