This library provides a comprehensive content model for narrative elements, usable in various contexts. You can install either the ContentLayer integration or the generic version.
- create type schemas
- create contentlayer models
- create react component templates / generator
- create react components for each entity/type
If you're working with ContentLayer:
npm install story-elements/content-layer
Generic version:
For a plain JavaScript/TypeScript project:
npm install story-elements/generic
Usage
ContentLayer Example:
import { Conflict, Theme } from 'story-elements/content-layer';
const Doc = defineDocumentType(() => ({
name: 'Doc',
filePathPattern: '**/*.md',
fields: {
conflict: { type: 'nested', of: Conflict },
theme: { type: 'nested', of: Theme },
},
}));```
Generic Example:
```javascript
import { Conflict, Theme } from 'story-elements/generic';
const exampleContent = {
conflict: {
description: 'Main user challenge',
type: 'internal',
},
theme: {
name: 'Innovation',
description: 'Focus on cutting-edge technology',
},
};