nuxt-modules / nuxt-modules/strapi
Integrated Blocks text support
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 717
- Forks
- 89
- Avg merge
- 7h 3m
- Merged PRs (30d)
- 6
Description
Hello,
A while ago i created this little module: Nuxt Strapi Blocks Renderer
I was wondering if it would be possible to contribute some of the functionality here, so that the other one could be archived. I was thinking about a composable maybe?
We already have useStrapiMedia, useStrapiVersion, etc. so what about something like useStrapiBlocksText:
<script setup lang="ts">
import type { Restaurant } from '~/types'
const { find } = useStrapi()
const { data } = await find<Restaurant>('restaurants')
const Description = useStrapiBlocksText(data.attributes.description)
</script>
<template>
<div>
<h1>{{ data.attributes.title }}</h1>
<Description />
</div>
</template>
We could also extend the useStrapi composable:
<script setup lang="ts">
import type { Restaurant } from '~/types'
const { find, Blocks } = useStrapi()
const { data } = await find<Restaurant>('restaurants')
</script>
<template>
<div>
<h1>{{ data.attributes.title }}</h1>
<Blocks :text="data.attributes.description" />
</div>
</template>
Internally, we could provide a default implementation for each block, they already exist in the other module. The user should be able to override each block component by either:
- using a predefined magic path -> e.g.
~/components/strapi/blocks/Paragraph.vue - configuration -> e.g.
strapi: { blocks: { paths: { paragraph: '~/components/MyParagraph.vue' } } }
We should discuss what this could look like, i'm open to suggestions and of course i would like to offer implementing this feature once we scoped how / if you want it in this module.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing Nuxt Strapi Blocks Renderer and the current useStrapi, useStrapiMedia, and useStrapiVersion composables. Scope the proposed Blocks or useStrapiBlocksText entry point, default block components, and magic-path or configuration-based overrides; done requires an agreed design before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- content, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100