Skip to content

Commit

Permalink
Merge pull request #62 from zackha/dev
Browse files Browse the repository at this point in the history
feat: add devtools
  • Loading branch information
zackha authored May 16, 2023
2 parents 1886e73 + 388cb7a commit 35b80a5
Show file tree
Hide file tree
Showing 6 changed files with 3,153 additions and 206 deletions.
33 changes: 3 additions & 30 deletions app.vue
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
<template>
<div class="mx-auto box-content w-full max-w-[935px] grow p-1">
<div role="tablist" class="my-4 flex max-w-full flex-col items-stretch">
<div class="flex flex-row flex-nowrap items-center gap-4">
<Logo />
<ProductSearchBox :searchTerm="searchTerm" :selectedCategory="selectedCategory" :loading="loading" v-model:searchTerm="searchTerm" />
<ButtonSelectCategory @click.stop="toggleDropdown('category')" :show="isDropdownCategory" :categories="categories" v-model:selectedCategory="selectedCategory" />
<ButtonSortBy @click.stop="toggleDropdown('sortBy')" :show="isDropdownSortBy" :options="options" v-model:selectedOption="selectedOption" />
</div>
</div>
<div class="grid grid-cols-3 gap-4">
<ProductCard v-for="product in products" :key="product.id" :product="product" />
<ProductSkeleton v-if="loading" />
</div>
<ProductEmpty v-if="!empty" :selectedCategory="selectedCategory" :searchTerm="searchTerm" />
<AppFooter />
</div>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</template>

<script setup>
const { products, empty, loading, categories, options, searchTerm, selectedCategory, selectedOption, isDropdownCategory, isDropdownSortBy } = useSearch();
const toggleDropdown = (type) => {
if (type === 'category') {
isDropdownCategory.value = !isDropdownCategory.value;
isDropdownSortBy.value = false;
} else if (type === 'sortBy') {
isDropdownSortBy.value = !isDropdownSortBy.value;
isDropdownCategory.value = false;
}
};
</script>

<style lang="postcss">
.dark {
@apply bg-black text-neutral-100;
Expand Down
5 changes: 5 additions & 0 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div class="mx-auto box-content w-full max-w-[935px] grow p-1">
<slot />
</div>
</template>
6 changes: 6 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ import pkg from './package.json';

export default defineNuxtConfig({
modules: ['@nuxt/image-edge', '@nuxtjs/tailwindcss', '@nuxtjs/color-mode', '@nuxtjs/apollo', 'nuxt-icon'],

runtimeConfig: {
public: {
version: pkg.version,
},
},

colorMode: {
classSuffix: '',
},

apollo: {
clients: {
default: {
httpEndpoint: process.env.GQL_HOST,
},
},
},

app: {
head: {
link: [
Expand All @@ -26,4 +30,6 @@ export default defineNuxtConfig({
],
},
},

devtools: true
});
Loading

0 comments on commit 35b80a5

Please sign in to comment.