This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Storybook smoketest to GitHub CI (#520)
* Add Storybook smoketest to GitHub CI * Reorganize files to accomodate Nuxt component discovery and exclude `.types` files from it * Fix linting issues
- Loading branch information
1 parent
19a5072
commit 01561ca
Showing
9 changed files
with
70 additions
and
49 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
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
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
# VTeleport and VTeleportTarget | ||
|
||
Directly based on code from https://gist.github.com/Alan-Liang/a847559433919ecb53dff217ed9708bb |
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,23 @@ | ||
<script> | ||
import { defineComponent } from '@nuxtjs/composition-api' | ||
import { targets } from './meta/targets' | ||
export default defineComponent({ | ||
name: 'VTeleport', | ||
props: { | ||
to: { type: String, required: true }, | ||
}, | ||
mounted() { | ||
if (!(this.to in targets)) | ||
throw new Error(`VTeleport: non-existent target ${this.to}`) | ||
targets[this.to].children.push(this) | ||
}, | ||
beforeDestroy() { | ||
if (!(this.to in targets)) | ||
throw new Error(`VTeleport: non-existent target ${this.to} on unmount`) | ||
const children = targets[this.to].children | ||
children.splice(children.indexOf(this), 1) | ||
}, | ||
render: (h) => h('span'), | ||
}) | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script> | ||
import { defineComponent } from '@nuxtjs/composition-api' | ||
import { targets } from './meta/targets' | ||
export default defineComponent({ | ||
name: 'VTeleportTarget', | ||
props: { | ||
name: { type: String, required: true }, | ||
}, | ||
data: () => ({ children: [] }), | ||
created() { | ||
if (this.name in targets) | ||
throw new Error(`VTeleportTarget: duplicate name ${this.name}`) | ||
targets[this.name] = this | ||
}, | ||
beforeDestroy() { | ||
delete targets[this.name] | ||
if (this.children.length > 0) | ||
throw new Error( | ||
`VTeleportTarget: ${this.name} beforeDestroy but still has children mounted` | ||
) | ||
}, | ||
render(h) { | ||
return h('div', this.children.map((vm) => vm.$slots.default || []).flat()) | ||
}, | ||
}) | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable unicorn/filename-case */ | ||
/** | ||
* Disable this rule for this file until there's a way to disable it more generally | ||
* for everything inside of the `meta` folders. | ||
* | ||
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/686 | ||
*/ | ||
/** | ||
* @type {Record<string, import('vue').Component>} | ||
*/ | ||
export const targets = {} |