-
Notifications
You must be signed in to change notification settings - Fork 37
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
6 changed files
with
150 additions
and
32 deletions.
There are no files selected for viewing
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,49 @@ | ||
import { cn } from "../../lib/utils"; | ||
|
||
interface BorderBeamProps { | ||
className?: string; | ||
size?: number; | ||
duration?: number; | ||
borderWidth?: number; | ||
anchor?: number; | ||
colorFrom?: string; | ||
colorTo?: string; | ||
delay?: number; | ||
} | ||
|
||
export default ({ | ||
className, | ||
size = 200, | ||
duration = 15, | ||
anchor = 90, | ||
borderWidth = 1.5, | ||
colorFrom = "#ffaa40", | ||
colorTo = "#9c40ff", | ||
delay = 0, | ||
}: BorderBeamProps) => { | ||
return ( | ||
<div | ||
style={ | ||
{ | ||
"--size": size, | ||
"--duration": duration, | ||
"--anchor": anchor, | ||
"--border-width": borderWidth, | ||
"--color-from": colorFrom, | ||
"--color-to": colorTo, | ||
"--delay": `-${delay}s`, | ||
} as React.CSSProperties | ||
} | ||
className={cn( | ||
"absolute z-10 inset-[0] rounded-[inherit] [border:calc(var(--border-width)*1px)_solid_transparent]", | ||
|
||
// mask styles | ||
"![mask-clip:padding-box,border-box] ![mask-composite:intersect] [mask:linear-gradient(transparent,transparent),linear-gradient(white,white)]", | ||
|
||
// pseudo styles | ||
"after:absolute after:aspect-square after:w-[calc(var(--size)*1px)] after:animate-border-beam after:[animation-delay:var(--delay)] after:[background:linear-gradient(to_left,var(--color-from),var(--color-to),transparent)] after:[offset-anchor:calc(var(--anchor)*1%)_50%] after:[offset-path:rect(0_auto_auto_0_round_calc(var(--size)*1px))]", | ||
className, | ||
)} | ||
/> | ||
); | ||
}; |
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,56 @@ | ||
import { ArrowRightIcon } from "lucide-react"; | ||
import { cn } from "../../lib/utils"; | ||
import { CSSProperties, FC, ReactNode } from "react"; | ||
|
||
interface AnimatedShinyTextProps { | ||
children: ReactNode; | ||
className?: string; | ||
shimmerWidth?: number; | ||
} | ||
|
||
const ShinyText: FC<AnimatedShinyTextProps> = ({ | ||
children, | ||
className, | ||
shimmerWidth = 100, | ||
}) => { | ||
return ( | ||
<p | ||
style={ | ||
{ | ||
"--shimmer-width": `${shimmerWidth}px`, | ||
} as CSSProperties | ||
} | ||
className={cn( | ||
"mx-auto max-w-md text-neutral-600/50 dark:text-neutral-400/50 ", | ||
|
||
// Shimmer effect | ||
"animate-shimmer bg-clip-text bg-no-repeat [background-position:0_0] [background-size:var(--shimmer-width)_100%] [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]", | ||
|
||
// Shimmer gradient | ||
"bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80", | ||
|
||
className, | ||
)} | ||
> | ||
{children} | ||
</p> | ||
); | ||
}; | ||
|
||
|
||
export default function ShinyTextEx() { | ||
return ( | ||
<div className="z-10 flex items-center justify-end"> | ||
<div | ||
className={cn( | ||
"group rounded-full border border-black/5 bg-neutral-100 text-base text-white transition-all ease-in hover:cursor-pointer hover:bg-neutral-200 dark:border-white/5 dark:bg-neutral-900 dark:hover:bg-neutral-800", | ||
)} | ||
> | ||
<ShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-600 hover:duration-300 hover:dark:text-neutral-400"> | ||
<span>📈 See Benchmark Details</span> | ||
<ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" /> | ||
</ShinyText> | ||
</div> | ||
</div> | ||
); | ||
} |
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