-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from BKWLD/add-mocking
Add mocks options
- Loading branch information
Showing
13 changed files
with
942 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SHOPIFY_URL= | ||
SHOPIFY_STOREFRONT_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- Demo using mocks --> | ||
|
||
<template lang='pug'> | ||
|
||
ul.mocks-demo: li(v-for='product in products') | ||
| {{ product.title }} | ||
|
||
</template> | ||
|
||
<!-- ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– --> | ||
|
||
<script lang='coffee'> | ||
import productFragment from '../../queries/fragments/product.gql' | ||
export default | ||
|
||
data: -> products: [] | ||
|
||
fetch: -> | ||
{ @products } = await @$storefront.execute query: ''' | ||
query getSomeProducts { | ||
products(first: 5) { | ||
edges { | ||
node { ...product } | ||
} | ||
} | ||
} | ||
''' + productFragment | ||
|
||
</script> | ||
|
||
<!-- ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– --> | ||
|
||
<style lang='stylus' scoped> | ||
|
||
.mocks-demo | ||
border 1px dashed currentColor | ||
padding 1em | ||
list-style disc | ||
|
||
li | ||
margin-left 1em | ||
margin-v .25em | ||
|
||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
# [@cloak-app/shopify](https://github.com/BKWLD/cloak-shopify) | ||
|
||
Check out this [example PDP](/products/clay-plant-pot). | ||
## PDP Example | ||
|
||
Check out this [example PDP](/products/clay-plant-pot) using live data from a demo Shopify store. | ||
|
||
## Mocking Example | ||
|
||
This is an example of using the `mocks` option to return mocked data. | ||
|
||
<mocks-demo></mocks-demo> | ||
|
||
```vue | ||
<template lang='pug'> | ||
ul: li(v-for='product in products') | ||
| {{ product.title }} | ||
</template> | ||
<script lang='coffee'> | ||
import productFragment from '../../queries/fragments/product.gql' | ||
export default | ||
data: -> products: [] | ||
fetch: -> | ||
{ @products } = await @$storefront.execute query: ''' | ||
query getSomeProducts { | ||
products(first: 5) { | ||
edges { | ||
node { ...product } | ||
} | ||
} | ||
} | ||
''' + productFragment | ||
</script> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.