commerce/components/filters/hompage-filters.tsx
Chloe 4edc2bb580
fix: homepage filters layout
Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
2024-06-12 18:22:27 +07:00

45 lines
1.4 KiB
TypeScript

import { getMenu, getMetaobjects } from 'lib/shopify';
import FiltersList from './filters-list';
const HomePageFilters = async () => {
const yearsData = getMetaobjects('make_model_year_composite');
const modelsData = getMetaobjects('make_model_composite');
const makesData = getMetaobjects('make');
const [years, models, makes] = await Promise.all([yearsData, modelsData, makesData]);
const menu = await getMenu('main-menu');
return (
<>
<h1 className="text-4xl font-bold tracking-tight text-white lg:text-6xl">
Find Your Car Part
</h1>
<div className="mt-5 flex grow flex-col items-center gap-3 @md:flex-row">
<FiltersList
years={years}
makes={makes}
models={models}
menu={menu}
autoFocusField="partType"
/>
</div>
</>
);
};
export const HomePageFiltersPlaceholder = () => {
return (
<>
<h1 className="text-4xl font-bold tracking-tight text-white lg:text-6xl">
Find Your Car Part
</h1>
<div className="mt-5 flex w-full flex-col items-center gap-3 md:flex-row">
<div className="h-9 w-full rounded bg-gray-50 opacity-50" />
<div className="h-9 w-full rounded bg-gray-50 opacity-50" />
<div className="h-9 w-full rounded bg-gray-50 opacity-50" />
</div>
</>
);
};
export default HomePageFilters;