Skip to content

Commit

Permalink
add tailwindcss, fix url resolver, add global components, add environ…
Browse files Browse the repository at this point in the history
…mental variables
  • Loading branch information
talalus committed Jun 1, 2020
1 parent 00ad56e commit 7c8a2e4
Show file tree
Hide file tree
Showing 40 changed files with 4,298 additions and 3,117 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAGENTO_BACKEND_URL=https://magento.test/graphql
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ module.exports = {
],
// add your custom rules here
rules: {
},
globals: {
BaseLoader: true,
BaseInlineSvg: true,
}
}
2 changes: 1 addition & 1 deletion .graphqlconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"extensions": {
"endpoints": {
"Default GraphQL Endpoint": {
"url": "https://magento23.test/graphql",
"url": "http://magento.test/graphql",
"headers": {
"user-agent": "JS GraphQL"
},
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

5 changes: 5 additions & 0 deletions assets/css/tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* purgecss start ignore */
@import 'tailwindcss/base';
@import 'tailwindcss/components';
/* purgecss end ignore */
@import 'tailwindcss/utilities';
1 change: 1 addition & 0 deletions assets/svg/chevron_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/svg/chevron_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/svg/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/svg/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/svg/multiply.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions components/Breadcrumbs.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<template>
<apollo-query
:query="require('~/queries/getBreadcrumbData.graphql')"
:variables="{ category_id: id }"
>
<template slot-scope="{ result: { data } }">
<template v-if="data" class="result apollo">
<div class="text-sm py-2">
<nuxt-link to="/">Home</nuxt-link>
<span class="px-2">/</span>
<template v-for="(breadcrumb, index) in data.category.breadcrumbs">
<nuxt-link
:to="`/${breadcrumb.category_url_path}.html`"
:key="index"
>
{{ breadcrumb.category_name }}
</nuxt-link>
<span class="px-2" :key="`seprator-${index}`">/</span>
</template>
<nuxt-link
:to="`/${data.category.url_path}.html`"
v-if="currentProduct"
>
{{ data.category.name }}
</nuxt-link>
<span v-else>
{{ data.category.name }}
</span>
<span v-if="currentProduct">
{{ currentProduct }}
</span>
</div>
</template>
</template>
</apollo-query>
</template>

<script>
export default {
props: {
id: {
type: String,
required: true
},
currentProduct: {
Type: String,
default: null
}
}
}
</script>
46 changes: 46 additions & 0 deletions components/CategoryList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<apollo-query
:query="require('~/queries/getCategory.graphql')"
:variables="{
id: id,
pageSize: 30,
currentPage: 1,
onServer: false,
filters: {},
sort: {
relevance: 'ASC'
}
}"
>
<template slot-scope="{ result: { loading, error, data }, isLoading }">
<!-- Loading -->
<BaseLoader v-if="isLoading" />
<!-- Error -->
<div v-else-if="error" class="error apollo">An error occurred</div>
<!-- Result -->
<div v-else-if="data" class="result apollo">
<h2 class="text-xl uppercase mb-6 text-center">
{{ data.category.name }}
</h2>
<ul>
<li v-for="product in data.products.items" :key="product.id">
<NuxtLink :to="'/' + product.url_key + '.html'">
{{ product.name }}
</NuxtLink>
</li>
</ul>
</div>
</template>
</apollo-query>
</template>

<script>
export default {
props: {
id: {
type: String,
required: true
}
}
}
</script>
18 changes: 18 additions & 0 deletions components/Footer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<footer
class="p-4 w-full border-t border-gray bg-gray-light text-gray-darker text-center"
>
<apollo-query :query="require('~/queries/getStoreConfigData.graphql')">
<template slot-scope="{ result: { loading, error, data }, isLoading }">
<!-- Loading -->
<div v-if="isLoading" class="loading apollo">Loading...</div>
<!-- Error -->
<div v-else-if="error" class="error apollo">An error occurred</div>
<!-- Result -->
<div v-else-if="data" class="result apollo">
<small class="text-xs">{{ data.storeConfig.copyright }}</small>
</div>
</template>
</apollo-query>
</footer>
</template>
22 changes: 22 additions & 0 deletions components/Header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<header
class="flex items-center justify-between absolute w-full bg-gray-light border-gray border-b"
>
<button @click="toggleNavigation">
<BaseInlineSvg svg="menu.svg" class="w-12 h-12 p-3" />
</button>
<nuxt-link to="/" alt="Hoopoe" class="mx-auto">
<BaseInlineSvg svg="logo.svg" class="w-12 h-12 p-2" />
</nuxt-link>
</header>
</template>

<script>
export default {
methods: {
toggleNavigation() {
this.$store.commit('toggleNavigation')
}
}
}
</script>
40 changes: 40 additions & 0 deletions components/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<section class="mx-auto text-center">
<h2 class="text-xl uppercase mb-6">Shop by category</h2>
<apollo-query
:query="require('~/queries/getNavigationMenu.graphql')"
:variables="{ id: rootCategoryId }"
>
<template slot-scope="{ result: { loading, error, data } }">
<!-- Loading -->
<div v-if="loading" class="loading apollo">Loading...</div>
<!-- Error -->
<div v-else-if="error" class="error apollo">An error occurred</div>
<!-- Result -->
<div v-else-if="data" class="result apollo flex justify-around">
<ul class="flex">
<li
v-for="category in data.category.children"
:key="category.id"
class="m-3"
>
<NuxtLink :to="category.url_path + '.html'">
{{ category.name }}
</NuxtLink>
</li>
</ul>
</div>
</template>
</apollo-query>
</section>
</template>

<script>
export default {
computed: {
rootCategoryId() {
return 2
}
}
}
</script>
4 changes: 0 additions & 4 deletions components/Loader.vue

This file was deleted.

79 changes: 0 additions & 79 deletions components/Logo.vue

This file was deleted.

8 changes: 7 additions & 1 deletion components/Product.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<template>
<div>
<h1>{{ product.name }}</h1>
<!-- eslint-disable-next-line -->
<div v-html="product.description.html"></div>
</div>
</template>

<script>
export default {
props: ['product']
props: {
product: {
type: Object,
required: true
}
}
}
</script>
15 changes: 15 additions & 0 deletions components/base/BaseInlineSvg.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<!-- eslint-disable-next-line -->
<div v-html="require(`~/assets/svg/${svg}?include`)"></div>
</template>

<script>
export default {
props: {
svg: {
type: String,
required: true
}
}
}
</script>
Loading

0 comments on commit 7c8a2e4

Please sign in to comment.