forked from Weaverse/pilot
-
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.
Merge branch 'Weaverse:main' into main
- Loading branch information
Showing
33 changed files
with
1,364 additions
and
1,104 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
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,50 @@ | ||
import type { | ||
TooltipContentProps, | ||
TooltipProps, | ||
TooltipTriggerProps, | ||
} from "@radix-ui/react-tooltip"; | ||
import { | ||
Arrow, | ||
Content, | ||
Portal, | ||
Provider, | ||
Root, | ||
Trigger, | ||
} from "@radix-ui/react-tooltip"; | ||
import { forwardRef } from "react"; | ||
import { cn } from "~/lib/cn"; | ||
|
||
export let TooltipProvider = Provider; | ||
export let Tooltip = ({ delayDuration = 100, ...rest }: TooltipProps) => ( | ||
<Root delayDuration={delayDuration} {...rest} /> | ||
); | ||
|
||
export let TooltipTrigger = ({ | ||
asChild = true, | ||
...rest | ||
}: TooltipTriggerProps) => <Trigger asChild={asChild} {...rest} />; | ||
|
||
export let TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>( | ||
({ children, className, sideOffset = 4, ...rest }, ref) => { | ||
return ( | ||
<Content | ||
ref={ref} | ||
className={cn( | ||
"animate-slideDownAndFade", | ||
"z-50 px-4 rounded py-1 shadow-sm text-background bg-body opacity-0", | ||
className, | ||
)} | ||
align="center" | ||
side="top" | ||
sideOffset={sideOffset} | ||
collisionPadding={8} | ||
{...rest} | ||
> | ||
<Arrow asChild> | ||
<span className="border-x-6 border-t-6 border-x-transparent border-t-body" /> | ||
</Arrow> | ||
{children} | ||
</Content> | ||
); | ||
}, | ||
); |
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,23 @@ | ||
import { useThemeSettings } from "@weaverse/hydrogen"; | ||
import { useCallback, useEffect } from "react"; | ||
|
||
export function useHeaderStyles(show: boolean) { | ||
let { stickyTopbar, topbarHeight } = useThemeSettings(); | ||
const updateStyles = useCallback(() => { | ||
let y = window.scrollY; | ||
let top = stickyTopbar ? topbarHeight : Math.max(topbarHeight - y, 0); | ||
document.body.style.setProperty("--announcement-bar-height", `${top}px`); | ||
}, [stickyTopbar, topbarHeight]); | ||
|
||
useEffect(() => { | ||
if (!show) { | ||
if (document.body.style.getPropertyValue("--announcement-bar-height")) { | ||
document.body.style.removeProperty("--announcement-bar-height"); | ||
} | ||
return; | ||
} | ||
updateStyles(); | ||
window.addEventListener("scroll", updateStyles); | ||
return () => window.removeEventListener("scroll", updateStyles); | ||
}, [updateStyles, show]); | ||
} |
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
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
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
Oops, something went wrong.