Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.0 #200

Merged
merged 13 commits into from
Aug 19, 2024
11 changes: 8 additions & 3 deletions app/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { cva } from "class-variance-authority";
import type { HTMLAttributes } from "react";
import { forwardRef } from "react";
import { cn } from "~/lib/cn";
import { IconCircleNotch } from "./Icons";
import { Link } from "./Link";
import { IconCircleNotch } from "./icons";
import { Link } from "./link";

let variants = cva(
[
Expand Down Expand Up @@ -57,7 +57,12 @@ let variants = cva(
"hover:text-[var(--color-button-text-hover)]",
"hover:border-[var(--color-button-border-hover)]",
],
link: ["bg-transparent py-2 border-b", "text-body", "border-b-body"],
link: [
"bg-transparent pb-1 text-body",
"after:bg-body after:absolute after:left-0 after:bottom-0.5 after:w-full after:h-px",
"after:scale-x-100 after:transition-transform after:origin-right",
"hover:after:origin-left hover:after:animate-underline",
],
},
},
defaultVariants: {
Expand Down
2 changes: 1 addition & 1 deletion app/components/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import * as React from "react";
import { cn } from "~/lib/cn";
import { IconCheck } from "./Icons";
import { IconCheck } from "./icons";

interface CheckboxProps
extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {
Expand Down
2 changes: 1 addition & 1 deletion app/components/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Image } from "@shopify/hydrogen";
import { useThemeSettings } from "@weaverse/hydrogen";
import clsx from "clsx";
import { Link } from "~/components/Link";
import { Link } from "~/components/link";

export function Logo({
isTransparent,
Expand Down
14 changes: 7 additions & 7 deletions app/components/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import type {
} from "@weaverse/hydrogen";
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import type { HTMLAttributes } from "react";
import type React from "react";
import type { HTMLAttributes } from "react";
import { forwardRef } from "react";
import { cn } from "~/lib/cn";
import type { BackgroundImageProps } from "./BackgroundImage";
import { backgroundInputs } from "./BackgroundImage";
import type { OverlayProps } from "./Overlay";
import { overlayInputs } from "./Overlay";
import { OverlayAndBackground } from "./OverlayAndBackground";
import type { BackgroundImageProps } from "./background-image";
import { backgroundInputs } from "./background-image";
import type { OverlayProps } from "./overlay";
import { overlayInputs } from "./overlay";
import { OverlayAndBackground } from "./overlay-and-background";

export type BackgroundProps = BackgroundImageProps & {
backgroundFor: "section" | "content";
Expand All @@ -36,7 +36,7 @@ let variants = cva("relative", {
width: {
full: "w-full h-full",
stretch: "w-full h-full",
fixed: "w-full h-full max-w-[var(--page-width,1280px)] mx-auto",
fixed: "w-full h-full max-w-page mx-auto",
},
padding: {
full: "",
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions app/components/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { BackgroundImageProps } from "./BackgroundImage";
import { BackgroundImage } from "./BackgroundImage";
import type { OverlayProps } from "./Overlay";
import { Overlay } from "./Overlay";
import type { BackgroundImageProps } from "./background-image";
import { BackgroundImage } from "./background-image";
import type { OverlayProps } from "./overlay";
import { Overlay } from "./overlay";

export interface OverlayAndBackgroundProps
extends BackgroundImageProps,
Expand Down
3 changes: 1 addition & 2 deletions app/hooks/useAnalytics.tsx → app/hooks/use-analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
useShopifyCookies,
} from "@shopify/hydrogen";
import { useEffect, useRef } from "react";

import { usePageAnalytics } from "./usePageAnalytics";
import { usePageAnalytics } from "./use-page-analytics";

export function useAnalytics(hasUserConsent: boolean) {
useShopifyCookies({ hasUserConsent });
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { useMatches } from "@remix-run/react";
import type { ShopifyPageViewPayload } from "@shopify/hydrogen";
import { useMemo } from "react";

import { DEFAULT_LOCALE } from "~/lib/utils";

export function usePageAnalytics({
hasUserConsent,
}: {
hasUserConsent: boolean;
}) {
const matches = useMatches();
let matches = useMatches();

return useMemo(() => {
const data: Record<string, unknown> = {};

matches.forEach((event) => {
const eventData = event?.data as Record<string, unknown>;
let data: Record<string, unknown> = {};
for (let match of matches) {
let eventData = match?.data as Record<string, unknown>;
if (eventData) {
eventData["analytics"] && Object.assign(data, eventData["analytics"]);

const selectedLocale =
(eventData["selectedLocale"] as typeof DEFAULT_LOCALE) ||
DEFAULT_LOCALE;

eventData.analytics && Object.assign(data, eventData.analytics);
let selectedLocale =
(eventData.selectedLocale as typeof DEFAULT_LOCALE) || DEFAULT_LOCALE;
Object.assign(data, {
currency: selectedLocale.currency,
acceptedLanguage: selectedLocale.language,
});
}
});
}

return {
...data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
NormalizedPredictiveSearch,
NormalizedPredictiveSearchResults,
UseSearchReturn,
} from "./types";
} from "~/types/predictive-search";

export const NO_PREDICTIVE_SEARCH_RESULTS: NormalizedPredictiveSearchResults = [
{ type: "queries", items: [] },
Expand Down
Loading