Skip to content

Commit

Permalink
Merge pull request #50 from deco-sites/feat/partials
Browse files Browse the repository at this point in the history
feat: use new partials
  • Loading branch information
tlgimenes authored Oct 24, 2023
2 parents 3f5f806 + eb37360 commit 10cf599
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions components/product/ProductShelfTabbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useOffer } from "$store/sdk/useOffer.ts";
import { usePlatform } from "$store/sdk/usePlatform.tsx";
import type { Product } from "apps/commerce/types.ts";
import { mapProductToAnalyticsItem } from "apps/commerce/utils/productToAnalyticsItem.ts";
import { usePartial } from "apps/website/hooks/usePartial.ts";
import { usePartialSection } from "deco/hooks/usePartialSection.ts";

/** @titleBy title */
interface Tab {
Expand Down Expand Up @@ -66,7 +66,7 @@ function TabbedProductShelf({
{tabs.map((tab, index) => (
<button
class={`tab tab-lg ${index === ti ? "tab-active" : ""}`}
{...usePartial({ id: sectionId, props: { tabIndex: index } })}
{...usePartialSection({ props: { tabIndex: index } })}
>
{tab.title}
</button>
Expand Down
9 changes: 5 additions & 4 deletions components/product/ProductVariantSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Avatar from "$store/components/ui/Avatar.tsx";
import { useVariantPossibilities } from "$store/sdk/useVariantPossiblities.ts";
import type { Product } from "apps/commerce/types.ts";
import { usePartial } from "apps/website/hooks/usePartial.ts";
import { usePartialSection } from "deco/hooks/usePartialSection.ts";

interface Props {
product: Product;
Expand All @@ -19,11 +19,12 @@ function VariantSelector({ product }: Props) {
<span class="text-sm">{name}</span>
<ul class="flex flex-row gap-3">
{Object.entries(possibilities[name]).map(([value, link]) => {
const partial = usePartial({ href: link });
// TODO: bring it back on fresh 1.5.3
// const partial = usePartialSection({ href: link });

return (
<li>
<button {...partial}>
<a href={link}>
<Avatar
content={value}
variant={link === url
Expand All @@ -32,7 +33,7 @@ function VariantSelector({ product }: Props) {
? "default"
: "disabled"}
/>
</button>
</a>
</li>
);
})}
Expand Down
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"imports": {
"$store/": "./",
"deco/": "https://denopkg.com/deco-cx/deco@1.43.0/",
"apps/": "https://denopkg.com/deco-cx/[email protected].1/",
"deco/": "https://denopkg.com/deco-cx/deco@1.44.1/",
"apps/": "https://denopkg.com/deco-cx/[email protected].2/",
"$fresh/": "https://denopkg.com/deco-cx/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
Expand Down

0 comments on commit 10cf599

Please sign in to comment.