Skip to content

Commit

Permalink
Merge branch 'Weaverse:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hta218 authored Dec 11, 2024
2 parents 98f4d84 + 7864136 commit 34b15d8
Show file tree
Hide file tree
Showing 79 changed files with 1,627 additions and 1,619 deletions.
25 changes: 0 additions & 25 deletions @/components/input.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion app/components/AddToCartButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import type { FetcherWithComponents } from '@remix-run/react';
import { useEffect } from 'react';

import { Button } from '@/components/button';
import { Button } from '~/components/button';
import { usePageAnalytics } from '~/hooks/usePageAnalytics';

export function AddToCartButton({
Expand Down
61 changes: 0 additions & 61 deletions app/components/Button.tsx

This file was deleted.

26 changes: 13 additions & 13 deletions app/components/Cart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from "@/components/button";
import { Input } from "@/components/input";
import { Button } from "~/components/button";
import { Input } from "~/components/input";
import { cn } from "@/lib/utils";
import { Link } from "@remix-run/react";
import { CartForm, Image, Money } from "@shopify/hydrogen";
Expand Down Expand Up @@ -67,20 +67,20 @@ function CartLines({
{layout === "page" && (
<thead>
<tr className="p-2">
<th className="font-medium p-4 text-left border-bar/15 border-b border-bar">
<th className="font-medium p-4 text-left border-border/15 border-b border-border">
Product
</th>
<th className="font-medium p-4 border-b border-bar/15 hidden md:table-cell"></th>
<th className="font-medium p-4 border-b border-bar/15 hidden md:table-cell">
<th className="font-medium p-4 border-b border-border/15 hidden md:table-cell"></th>
<th className="font-medium p-4 border-b border-border/15 hidden md:table-cell">
Price
</th>
<th className="font-medium p-4 border-b border-bar/15 hidden md:table-cell">
<th className="font-medium p-4 border-b border-border/15 hidden md:table-cell">
Quantity
</th>
<th className="font-medium p-4 border-b border-bar/15 hidden md:table-cell">
<th className="font-medium p-4 border-b border-border/15 hidden md:table-cell">
Total
</th>
<th className="font-medium p-4 border-b border-bar/15 hidden md:table-cell"></th>
<th className="font-medium p-4 border-b border-border/15 hidden md:table-cell"></th>
</tr>
</thead>
)}
Expand Down Expand Up @@ -130,7 +130,7 @@ function CartLineItem({
height={100}
loading="lazy"
width={100}
className="object-cover"
className="object-cover rounded-[2px]"
/>
)}
</td>
Expand Down Expand Up @@ -208,7 +208,7 @@ function CartCheckout({
layout: CartMainProps["layout"];
}) {
let styles = {
page: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-1 border-bar-subtle md:border-t md:pt-6 lg:p-0 lg:border-none",
page: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-1 border-border-subtle md:border-t md:pt-6 lg:p-0 lg:border-none",
aside: "pb-6 pt-4 shrink-0",
};
let isDrawer = layout === "aside";
Expand Down Expand Up @@ -295,7 +295,7 @@ export function CartSummary({
}) {
const styles = {
page: "bg-white p-6 space-y-6",
aside: "space-y-6 border-t border-bar-subtle pt-4",
aside: "space-y-6 border-t border-border-subtle pt-4",
};
const totalStyles = {
page: "text-2xl font-heading",
Expand Down Expand Up @@ -355,7 +355,7 @@ function CartLineQuantity({
aside: "w-10 h-[35px] transition",
};
return (
<div className="flex items-center border border-bar-subtle rounded w-fit">
<div className="flex items-center border border-border-subtle rounded w-fit">
<CartLineUpdateButton lines={[{ id: lineId, quantity: prevQuantity }]}>
<button
className={buttonStyles[layout]}
Expand Down Expand Up @@ -467,7 +467,7 @@ function CartDiscounts({
{/* Show an input to apply a discount */}
<UpdateDiscountForm discountCodes={codes}>
<div className="flex gap-2">
<Input type="text" name="discountCode" placeholder="Promotion code" />
<Input type="text" name="discountCode" variant={"default"} placeholder="Promotion code" />
<Button type="submit" variant="link">
Apply
</Button>
Expand Down
13 changes: 7 additions & 6 deletions app/components/CountrySelector.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {useFetcher, useLocation, useRouteLoaderData} from '@remix-run/react';
import {CartForm} from '@shopify/hydrogen';
import type {CartBuyerIdentityInput} from '@shopify/hydrogen/storefront-api-types';
import {Button} from '~/components/Button';
import {IconCaret, IconCheck} from '~/components/Icon';
import type {Locale, Localizations} from '~/lib/type';
import {DEFAULT_LOCALE} from '~/lib/utils';
import {useRootLoaderData} from '~/root';
import clsx from 'clsx';
import {useCallback, useEffect, useRef, useState} from 'react';
import {useInView} from 'react-intersection-observer';
import { Button } from '~/components/button';

export function CountrySelector() {
const fetcher = useFetcher();
Expand Down Expand Up @@ -57,7 +57,7 @@ export function CountrySelector() {
<div ref={observerRef} className="md:max-w-72 w-full" onMouseLeave={closeDropdown}>
<div className="relative">
<details
className="w-full overflow-hidden rounded border border-bar-subtle dark:border-white"
className="w-full overflow-hidden rounded border border-border-subtle dark:border-white"
ref={closeRef}
onToggle={toggleDropdown}
>
Expand All @@ -67,7 +67,7 @@ export function CountrySelector() {
<IconCaret direction="down" className="h-4 w-4" />
</span>
</summary>
<div className={`hiddenScroll absolute bottom-full left-0 right-0 w-full overflow-auto border-t border-bar-subtle bg-white dark:border-white transition-all duration-500
<div className={`hiddenScroll absolute bottom-full left-0 right-0 w-full overflow-auto border-t border-border-subtle bg-background dark:border-white transition-all duration-500
${isOpen ? 'max-h-36' : 'max-h-0'}`}>
{countries &&
Object.keys(countries).map((countryPath) => {
Expand Down Expand Up @@ -117,12 +117,13 @@ function Country({
}}
>
<Button
className={clsx([
'flex w-full justify-start rounded bg-background p-2 transition',
classNameContainer={clsx([
'flex w-full justify-start',
'cursor-pointer items-center px-4 py-2 text-left',
])}
className='rounded bg-background p-2 transition w-full'
variant={"custom"}
type="submit"
variant="primary"
onClick={closeDropdown}
>
{countryLocale.label}
Expand Down
13 changes: 5 additions & 8 deletions app/components/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,12 @@ export function Drawer({
>
<Dialog.Panel
className={cn(
"transform text-left align-middle shadow-xl transition-all",
"transform text-left align-middle shadow-xl transition-all bg-[var(--color-drawer-bg)]",
openFrom === "left"
? `h-screen-dynamic w-screen ${maxWidth}`
: openFrom === "top"
? "h-fit w-screen"
: `h-screen-dynamic w-screen ${maxWidth}`,
isForm === "cart" || isForm === "filter"
? "bg-background-basic"
: "bg-background-subtle-1"
: `h-screen-dynamic w-screen ${maxWidth}`
)}
>
<header
Expand All @@ -92,23 +89,23 @@ export function Drawer({
>
<button
type="button"
className="text-body hover:text-body/50 -m-4 p-4 transition"
className="text-text-primary hover:text-text-primary/50 -m-4 p-4 transition"
onClick={onClose}
data-test="close-cart"
>
<IconClose aria-label="Close panel" />
</button>
{heading !== null && (
<Dialog.Title as="span">
<span className={cn("font-semibold font-heading text-xl", isForm !== 'search' && 'uppercase')} id="cart-contents">
<span className={cn("font-semibold font-heading text-xl text-text-primary", isForm !== 'search' && 'uppercase')} id="cart-contents">
{heading}
</span>
</Dialog.Title>
)}
{isBackMenu && (
<button
type="button"
className="text-body hover:text-body/50 -m-4 p-2 transition"
className="text-text-primary hover:text-text-primary/50 -m-4 p-2 transition"
onClick={onClose}
data-test="close-cart"
>
Expand Down
12 changes: 6 additions & 6 deletions app/components/DrawerFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Button} from '@/components/button';
import {Checkbox} from '@/components/checkbox';
import {Input} from '@/components/input';
import {Button} from '~/components/button';
import {Checkbox} from '~/components/checkbox';
import {Input} from '~/components/input';
import {Disclosure, Menu} from '@headlessui/react';
import {
Link,
Expand Down Expand Up @@ -45,7 +45,7 @@ export function DrawerFilter({
const {openDrawer, isOpen, closeDrawer} = useDrawer();
return (
<>
<div className="border-y border-bar-subtle py-4 px-3 md:px-4 lg:px-0">
<div className="border-y border-border-subtle py-4 px-3 md:px-4 lg:px-0">
<div className="container flex w-full items-center justify-between">
<span className="font-heading text-xl font-medium tracking-tight">
{productNumber} Products
Expand Down Expand Up @@ -137,7 +137,7 @@ export function FiltersDrawer({

return (
<nav className="">
<div className="divide-y divide-bar-subtle">
<div className="divide-y divide-border-subtle">
{filters.map((filter: Filter) => (
<Disclosure as="div" key={filter.id} className="w-full pb-6 pt-5">
{({open}) => (
Expand Down Expand Up @@ -315,7 +315,7 @@ export default function SortMenu({

return (
<Menu as="div" className="relative z-30">
<Menu.Button className="flex h-[50px] items-center gap-[10px] rounded border border-foreground px-4 py-3">
<Menu.Button className="flex h-[50px] items-center gap-[10px] rounded border border-border px-4 py-3">
<span className="font-heading text-xl font-medium">Sort by</span>
<IconCaret />
</Menu.Button>
Expand Down
7 changes: 3 additions & 4 deletions app/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Button} from '@/components/button';
import {Input} from '@/components/input';
import {Button} from '~/components/button';
import {Input} from '~/components/input';
import {Disclosure} from '@headlessui/react';
import {NavLink, useFetcher} from '@remix-run/react';
import {useThemeSettings} from '@weaverse/hydrogen';
Expand All @@ -12,7 +12,6 @@ import {IconPlusLinkFooter} from './Icon';
import {LayoutProps} from './Layout';

type FooterProps = Pick<LayoutProps, 'footerMenu'>;
type TagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
export function Footer({footerMenu}: FooterProps) {
let fetcher = useFetcher<any>();
let isError = fetcher.state === 'idle' && fetcher.data?.errors;
Expand All @@ -26,7 +25,7 @@ export function Footer({footerMenu}: FooterProps) {
tagNameTitle: Tag = 'h6',
} = settings;
return (
<footer className="footer w-full bg-[var(--footer-menu-background-color)]">
<footer className="footer w-full bg-[var(--color-footer-bg)] text-[var(--color-footer-text)] border-t border-[var(--color-footer-text)]">
<div className="container flex h-fit flex-col gap-6 px-4 pb-10 pt-6 md:gap-10 md:px-6 md:py-10 lg:gap-8 lg:px-0 lg:py-16">
<div className="flex flex-col justify-center gap-4 md:flex-row md:gap-4 lg:gap-10">
<div className="flex w-full flex-col items-start gap-6 border-b border-foreground pb-6 md:h-fit md:border-none md:pb-0">
Expand Down
16 changes: 5 additions & 11 deletions app/components/Header/AnnouncementBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ export function AnnouncementBar() {
let {
content,
textSize,
textColor,
borderColor,
backgroundColor,
announcementBarHeight,
speed,
gap,
stickyAnnouncementBar,
enableScrollingText,
} = settings;
let style: CSSProperties = {
'--text-color': textColor,
'--border-color': borderColor,
'--background-color': backgroundColor,
'--height-bar': `${announcementBarHeight}px`,
'--speed': `${speed}s`,
'--gap': `${gap}px`,
Expand Down Expand Up @@ -59,15 +53,15 @@ export function AnnouncementBar() {
ref={containerRef}
style={style}
className={clsx(
'h-[var(--height-bar)] bg-[var(--background-color)] py-[var(--vertical-padding)]',
'border-y border-y-[var(--border-color)]',
'h-[var(--height-bar)] bg-[var(--color-topbar-bg)] py-[var(--vertical-padding)]',
'border-y border-y-[var(--color-topbar-border)]',
'flex w-full items-center justify-center overflow-hidden',
stickyAnnouncementBar ? 'sticky top-0 z-40' : 'relative',
)}
>
<button
onClick={handleClose}
className="absolute right-4 top-1/2 z-20 -translate-y-1/2 transform cursor-pointer border-none bg-transparent text-[var(--text-color)]"
className="absolute right-4 top-1/2 z-20 -translate-y-1/2 transform cursor-pointer border-none bg-transparent text-[var(--color-topbar-text)]"
>
×
</button>
Expand All @@ -79,7 +73,7 @@ export function AnnouncementBar() {
{Array.from({length: 15}).map((_, i) => (
<li
key={i}
className="animate-scrollContent whitespace-nowrap pr-[var(--gap)] font-body font-normal text-[var(--text-color)]"
className="animate-scrollContent whitespace-nowrap pr-[var(--gap)] font-body font-normal text-[var(--color-topbar-text)]"
style={{
animationDuration: `var(--speed)`,
fontSize: `${textSize}px`,
Expand All @@ -100,7 +94,7 @@ export function AnnouncementBar() {
>
<div
ref={contentRef}
className="w-fit whitespace-nowrap px-11 font-body font-normal text-[var(--text-color)]"
className="w-fit whitespace-nowrap px-11 font-body font-normal text-[var(--color-topbar-text)]"
>
{content}
</div>
Expand Down
Loading

0 comments on commit 34b15d8

Please sign in to comment.