-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
151 additions
and
40 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use client"; | ||
|
||
import { EMAIL } from "@/lib/constants"; | ||
import { useCopy } from "@/lib/useCopy"; | ||
import { CheckIcon, MailIcon, SendIcon } from "lucide-react"; | ||
import { Badge } from "./ui/badge"; | ||
|
||
export const CopyMailBadge = () => { | ||
const { hasCopied, handleClick } = useCopy(EMAIL); | ||
const Icon = hasCopied ? CheckIcon : SendIcon; | ||
|
||
return ( | ||
<Badge className="cursor-pointer" onClick={handleClick}> | ||
<Icon size={16} className="inline-block" /> | ||
<span>{EMAIL}</span> | ||
</Badge> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use client"; | ||
|
||
import { GITHUB_PROFILE } from "@/lib/constants"; | ||
import { useTheme } from "next-themes"; | ||
import { useEffect, useState } from "react"; | ||
import { UrlBadgeWithMetadata } from "../UrlBadge"; | ||
|
||
export function GithubIcon() { | ||
const { resolvedTheme: theme } = useTheme(); | ||
const [mounted, setMounted] = useState(false); | ||
|
||
useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
|
||
return ( | ||
<UrlBadgeWithMetadata | ||
url={GITHUB_PROFILE} | ||
title="GitHub" | ||
favicon={ | ||
mounted && theme === "dark" | ||
? "/icons/github-mark-white.svg" | ||
: "/icons/github-mark.svg" | ||
} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Slot } from "@radix-ui/react-slot"; | ||
import { type VariantProps, cva } from "class-variance-authority"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
const badgeVariants = cva( | ||
"inline w-max rounded-md border border-neutral-200 dark:border-neutral-700 hover:border-neutral-300 hover:dark:border-neutral-600 bg-accent text-accent-foreground p-1 space-x-1 !no-underline leading-4 text-sm whitespace-nowrap", | ||
{ | ||
variants: { | ||
variant: {}, | ||
}, | ||
defaultVariants: {}, | ||
}, | ||
); | ||
|
||
export interface BadgeProps | ||
extends React.HTMLAttributes<HTMLDivElement>, | ||
VariantProps<typeof badgeVariants> { | ||
asChild?: boolean; | ||
} | ||
|
||
function Badge({ className, variant, asChild, ...props }: BadgeProps) { | ||
const Comp = asChild ? Slot : "span"; | ||
return ( | ||
<Comp className={cn(badgeVariants({ variant }), className)} {...props} /> | ||
); | ||
} | ||
|
||
export { Badge, badgeVariants }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useState } from "react"; | ||
|
||
export const useCopy = (text: string) => { | ||
const [hasCopied, setHasCopied] = useState(false); | ||
|
||
const handleClick = () => { | ||
if (hasCopied) return; | ||
|
||
if (navigator.clipboard) { | ||
navigator.clipboard.writeText(text); | ||
} | ||
setHasCopied(true); | ||
|
||
setTimeout(() => { | ||
setHasCopied(false); | ||
}, 2000); | ||
}; | ||
|
||
return { hasCopied, handleClick }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters