Skip to content

Commit

Permalink
Merge pull request #4 from Applelo/dev
Browse files Browse the repository at this point in the history
Update docs, fix nuxt module, bump to 0.7.1
  • Loading branch information
Applelo authored Nov 16, 2022
2 parents 0b8c664 + 4ade14b commit c957dcd
Show file tree
Hide file tree
Showing 14 changed files with 937 additions and 1,116 deletions.
75 changes: 12 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

> This module is not compatible with VueJS 2 and NuxtJS 2
<center>

👉 **[Demo](https://applelo.github.io/zoom-avant/demo.html)** 👈

</center>

## Features

- 🚀 Simple and efficient using modern API
Expand Down Expand Up @@ -38,69 +44,12 @@ yarn add -D @zoom-avant/nuxt
pnpm add -D @zoom-avant/nuxt
```

## Usage

For **VueJS 3**, import all the components and css styles.

```vue
<script setup lang="ts">
import { ZAvant, ZAvantMenu, ZAvantItem } from '@zoom-avant/vue'
import '@zoom-avant/vue/css'
</script>
```

For **Nuxt 3**, just add the `@zoom-avant/nuxt` module in your `nuxt.config.ts`.
## Next

```ts
import { defineNuxtConfig } from 'nuxt/config'
Read the **[documentation](https://applelo.github.io/zoom-avant/guide/)** 🤓

export default defineNuxtConfig({
modules: ['@zoom-avant/nuxt']
})
```

In your template, add the ZoomAvant structure :

```vue
<template>
<ZAvant :dynamic-height="true">
<ZAvantItem>
<ZAvantMenu next="Next 1">
<ZAvantItem>Hello</ZAvantItem>
<ZAvantItem>world</ZAvantItem>
<ZAvantItem>Bonjour</ZAvantItem>
</ZAvantMenu>
</ZAvantItem>
<ZAvantItem>
<ZAvantMenu next="Next 2" back="Next 2">
<ZAvantItem>Cheese</ZAvantItem>
<ZAvantItem>Fromage</ZAvantItem>
<ZAvantItem>Brie</ZAvantItem>
<ZAvantItem>
<ZAvantMenu>
<template #next>
<span>Bonjour le monde</span>
</template>
<template #back>
<span>Retour</span>
</template>
<template #default>
<ZAvantItem>
<a href="#">Hello</a>
</ZAvantItem>
<ZAvantItem>
<a href="#">world</a>
</ZAvantItem>
</template>
</ZAvantMenu>
</ZAvantItem>
</ZAvantMenu>
</ZAvantItem>
<ZAvantItem>
<a href="#">Bonjour le monde</a>
</ZAvantItem>
</ZAvant>
</template>
```
## Credits

<!-- For more information, consult the documentation. -->
- [Foundation Drilldown](https://get.foundation/sites/docs/drilldown-menu.html)
- [Aria Pattern Menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/)
- [Anu](https://github.com/jd-solanki/anu) and [Pinia](https://github.com/vuejs/pinia) packages for the inspiration
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"workspaces": [
"packages/*"
],
"version": "0.7.0",
"version": "0.7.1",
"description": "",
"type": "module",
"engines": {
Expand All @@ -22,7 +22,7 @@
"author": "",
"license": "GPL-3.0",
"devDependencies": {
"@vue/test-utils": "^2.2.2",
"@vue/test-utils": "^2.2.3",
"happy-dom": "^7.7.0",
"prettier": "^2.7.1",
"vitest": "^0.25.2",
Expand Down
1 change: 1 addition & 0 deletions packages/documentation/docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default defineConfig({
// appId: '',
// apiKey: ''
// },
nav: [{ text: 'Demo', link: '/demo' }],
sidebar: {
'/guide/': [
{
Expand Down
5 changes: 5 additions & 0 deletions packages/documentation/docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@
.dark .VPNavBar.has-sidebar.has-sidebar .content {
background: rgba(0, 0, 0, 0.7);
}

.stackblitz {
height: 400px !important;
background-color: rgba(72, 49, 212, 0.25);
}
139 changes: 139 additions & 0 deletions packages/documentation/docs/demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: Demo
layout: false
---

<script setup>
import {ZAvant, ZAvantMenu, ZAvantItem} from '@zoom-avant/vue'
import {ref} from 'vue'

const model = ref()
</script>

<style lang="scss">
@import '@zoom-avant/vue/css/base';
@import '@zoom-avant/vue/css/animation';

body {
padding: 2rem;
background-color: var(--vp-c-bg);
color: var(--vp-c-text-1);
}

.demo {
margin: 2rem 0;
}

.demo__zavant {
background-color: rgba(72, 49, 212, 0.25);
padding: 1rem;
max-width: 300px;
margin: 1rem 0;

a {
font-weight: 400;
}
}

.zavant__item + .zavant__item {
margin-top: .75rem;
}

a {
font-weight: 500;
color: var(--vp-c-brand);
transition: color 0.25s;

&:hover {
color: var(--vp-c-brand-dark);
}
}

.zavant__next,
.zavant__back {
text-decoration: underline;

&:hover {
text-decoration: none;
}
}

button, a {
font-size: 1rem;
}

button:not([class]) {
background-color: var(--vp-c-text-1);
color: var(--vp-c-bg);
padding: .25rem .5rem;
margin: .5rem 0;
}

.back {
display:block;
font-size: 14px;
font-weight: 500;
color: var(--vp-c-text-1);
transition: color 0.25s;
margin-bottom: 2rem;

&:hover {
color: var(--vp-c-brand);
}
}
</style>

<a href="/" class="back">Go back to the documentation</a>

This is a demo of ZoomAvant with all props/slots. It uses custom [styles](/guide/styles.html) and also it is [Control programatically](/guide/usage.html#control-programatically) thanks to `v-model`.

You can check on StackBlitz a lighter demo for [Vue](https://stackblitz.com/edit/playground-zavant-vue?file=src/App.vue) and [Nuxt](https://stackblitz.com/edit/playground-zavant-nuxt?file=nuxt.config.ts).

<div class="demo">
<p>Path of the v-model : {{ model }}</p>
<div class="demo__zavant">
<ZAvant :dynamic-height="true" v-model="model">
<ZAvantItem>
<ZAvantMenu next="Item 0 1">
<ZAvantItem>Item 1 1</ZAvantItem>
<ZAvantItem>Item 1 2</ZAvantItem>
<ZAvantItem>Item 1 3</ZAvantItem>
</ZAvantMenu>
</ZAvantItem>
<ZAvantItem>
<ZAvantMenu next="Item 0 2" back="Back to root">
<ZAvantItem>Item 2 1</ZAvantItem>
<ZAvantItem>Item 2 2</ZAvantItem>
<ZAvantItem>Item 2 2</ZAvantItem>
<ZAvantItem>
<ZAvantMenu>
<template #next>
<span>Item 2 3</span>
</template>
<template #back>
<span>Back to 1</span>
</template>
<template #default>
<ZAvantItem>
<a href="#">Item 2 4</a>
</ZAvantItem>
<ZAvantItem>
<a href="#">Item 2 5</a>
</ZAvantItem>
</template>
</ZAvantMenu>
</ZAvantItem>
</ZAvantMenu>
</ZAvantItem>
<ZAvantItem>
<a href="#">Item 0 3</a>
</ZAvantItem>
</ZAvant>
</div>
<p>
<button @click="model.pop()">Back button outside</button>
</p>
<p>
<button @click="model = [2, 1]">Go to [2, 1]</button>
</p>
</div>
6 changes: 3 additions & 3 deletions packages/documentation/docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ export default defineNuxtConfig({

## Credits

- Foundation Drilldown
- Aria Pattern Menu
- AnuVue and Pinia packages for the packages strucure
- [Foundation Drilldown](https://get.foundation/sites/docs/drilldown-menu.html)
- [Aria Pattern Menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/)
- [Anu](https://github.com/jd-solanki/anu) and [Pinia](https://github.com/vuejs/pinia) packages for the inspiration
4 changes: 4 additions & 0 deletions packages/documentation/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
layout: home
title: Home

hero:
name: Zoom Avant
Expand All @@ -11,6 +12,9 @@ hero:
- theme: alt
text: View on GitHub
link: https://github.com/Applelo/zoom-avant
- theme: alt
text: Demo
link: /demo

features:
- icon: 🚀
Expand Down
4 changes: 3 additions & 1 deletion packages/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"author": "",
"license": "ISC",
"devDependencies": {
"vitepress": "1.0.0-alpha.28",
"@zoom-avant/vue": "=>0.7.0 <1.0.0",
"sass": "^1.56.1",
"vitepress": "1.0.0-alpha.29",
"vue": "^3.2.45"
}
}
70 changes: 14 additions & 56 deletions packages/nuxt/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Zoom Avant / Nuxt
[![npm (scoped)](https://img.shields.io/npm/v/@zoom-avant/nuxt)](https://www.npmjs.com/package/@zoom-avant/nuxt)

> Currently in _alpha_
# Zoom Avant / Nuxt

**Zoom Avant** (pronounced /zum a.vɑ̃/) is a drilldown component for VueJS 3.

> This module is not compatible with NuxtJS 2
<center>

👉 **[Demo](https://applelo.github.io/zoom-avant/demo.html)** 👈

</center>

## Install

```
Expand All @@ -18,60 +24,12 @@ yarn add -D @zoom-avant/nuxt
pnpm add -D @zoom-avant/nuxt
```

## Usage
## Next

Add the `@zoom-avant/nuxt` module in your `nuxt.config.ts` file.
Read the **[documentation](https://applelo.github.io/zoom-avant/guide/)** 🤓

The module will uses features from Nuxt3 to auto import the components and the css styles for you.
## Credits

```ts
import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
modules: ['@zoom-avant/nuxt']
})
```

In your template, add the ZoomAvant structure :

```vue
<template>
<ZAvant :dynamic-height="true">
<ZAvantItem>
<ZAvantMenu next="Next 1">
<ZAvantItem>Hello</ZAvantItem>
<ZAvantItem>world</ZAvantItem>
<ZAvantItem>Bonjour</ZAvantItem>
</ZAvantMenu>
</ZAvantItem>
<ZAvantItem>
<ZAvantMenu next="Next 2">
<ZAvantItem>Cheese</ZAvantItem>
<ZAvantItem>Fromage</ZAvantItem>
<ZAvantItem>Brie</ZAvantItem>
<ZAvantItem>
<ZAvantMenu>
<template #next>
<span>Bonjour le monde</span>
</template>
<template #back>
<span>Retour</span>
</template>
<template #default>
<ZAvantItem>
<a href="#">Hello</a>
</ZAvantItem>
<ZAvantItem>
<a href="#">world</a>
</ZAvantItem>
</template>
</ZAvantMenu>
</ZAvantItem>
</ZAvantMenu>
</ZAvantItem>
<ZAvantItem>
<a href="#">Bonjour le monde</a>
</ZAvantItem>
</ZAvant>
</template>
```
- [Foundation Drilldown](https://get.foundation/sites/docs/drilldown-menu.html)
- [Aria Pattern Menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/)
- [Anu](https://github.com/jd-solanki/anu) and [Pinia](https://github.com/vuejs/pinia) packages for the inspiration
Loading

0 comments on commit c957dcd

Please sign in to comment.