-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
94 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-schema": patch | ||
--- | ||
|
||
Added missing schemaType prop to DruxtSchemaMixin |
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,10 @@ | ||
# schema-component | ||
|
||
This directory contains an example component using a Druxt Schema to render non-Drupal entity data. | ||
|
||
|
||
## Setup | ||
|
||
``` | ||
yarn && yarn dev | ||
``` |
27 changes: 27 additions & 0 deletions
27
examples/nuxt/schema-component/components/SchemaComponent.vue
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 @@ | ||
<template> | ||
<div v-if="$fetchState.pending">Loading ...</div> | ||
<div v-else> | ||
<div v-for="field of schema.fields.filter((o) => data[o.id])" :key="field.id"> | ||
<strong>{{ field.id }}:</strong> | ||
<pre><code>{{ JSON.stringify(data[field.id], null, ' ') }}</code></pre> | ||
<details> | ||
<summary><strong>Field schema</strong></summary> | ||
<pre><code>{{ JSON.stringify(field, null, ' ') }}</code></pre> | ||
</details> | ||
<br /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { DruxtSchemaMixin } from 'druxt-schema' | ||
export default { | ||
mixins: [DruxtSchemaMixin], | ||
props: { | ||
data: { | ||
type: Object, | ||
required: true | ||
} | ||
}, | ||
} | ||
</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,4 @@ | ||
export default { | ||
buildModules: [['druxt-schema', { baseUrl: 'https://demo-api.druxtjs.org' }]], | ||
components: true | ||
} |
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 @@ | ||
{ | ||
"name": "schema-component", | ||
"scripts": { | ||
"dev": "nuxt dev" | ||
}, | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"druxt-schmea": "link:../../../packages/druxt-schema", | ||
"nuxt": "latest" | ||
} | ||
} |
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,14 @@ | ||
<template> | ||
<div> | ||
<h1>Custom component using DruxtSchemaMixin</h1> | ||
<p>This demonstrates the ability to use Drupal Display settings, field placement and configuration, with non-Drupal data.</p> | ||
<hr /> | ||
<SchemaComponent | ||
type="node--page" | ||
:data="{ | ||
body: 'Praesent sapien massa, convallis a pellentesque nec, egestas non nisi. Donec sollicitudin molestie malesuada. Mauris blandit aliquet elit, eget tincidunt nibh pulvinar a. Nulla quis lorem ut libero malesuada feugiat.', | ||
links: ['https://druxtjs.org'] | ||
}" | ||
/> | ||
</div> | ||
</template> |
Empty file.
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