Skip to content

Commit

Permalink
chore: move casing
Browse files Browse the repository at this point in the history
  • Loading branch information
ddaoxuan committed Oct 18, 2024
1 parent 0668bf6 commit fb68aed
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
35 changes: 35 additions & 0 deletions starters/shopify-algolia/components/Icons.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { Meta } from "@storybook/react"
import { ArrowIcon } from "./ArrowIcon"
import { CaretSortIcon } from "./CaretSortIcon"
import { CheckIcon } from "./CheckIcon"
import { ChevronIcon } from "./ChevronIcon"
import { CloseIcon } from "./CloseIcon"
import { FavoritesIcon } from "./FavoritesIcon"
import { FiltersIcon } from "./FiltersIcon"
import { HeartIcon } from "./HeartIcon"
import { SearchIcon } from "./SearchIcon"

const meta: Meta = {
title: "Icons",
args: {},
argTypes: {},
}

export const Default = {
render: () => (
<div className="grid w-full max-w-xs grid-cols-[repeat(_auto-fill,minmax(32px,1fr)_)] items-start gap-4 gap-y-8">
<ArrowIcon />
<CaretSortIcon />
<CheckIcon />
<ChevronIcon />
<CloseIcon />
<FavoritesIcon />
<FiltersIcon />
<HeartIcon />
<HeartIcon />
<SearchIcon />
</div>
),
}

export default meta
33 changes: 33 additions & 0 deletions starters/shopify-algolia/components/under.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { algolia } from "clients/search"
import { unstable_cache } from "next/cache"
import { ComparisonOperators } from "lib/algolia/filterBuilder"
import { CarouselSection } from "./CarouselSection"
import { getDemoProducts, isDemoMode } from "utils/demoUtils"
import type { CommerceProduct } from "types"
import { env } from "env.mjs"

export async function EverythingUnderSection() {
const items = await getPriceRangedProducts()

if (!items.length) return null

return <CarouselSection className="my-16" title="Everything under $50" items={items} />
}

const getPriceRangedProducts = unstable_cache(
async () => {
if (isDemoMode()) return getDemoProducts().hits.slice(0, 8)

const { hits } = await algolia.search<CommerceProduct>({
indexName: env.ALGOLIA_PRODUCTS_INDEX,
searchParams: {
hitsPerPage: 8,
filters: algolia.filterBuilder().where("minPrice", 50, ComparisonOperators.LessThanOrEqual).build(),
},
})

return hits
},
["relevant-products"],
{ revalidate: 3600 }
)

0 comments on commit fb68aed

Please sign in to comment.