lukaszwisniewski88/svelte-datocms

Structured text tests

Opened this issue · 3 comments

Nothing special, just need to test the component

Hi, any news on this? A minimum documentation on how to use this component will be very appreciated...

Hi!

You can find the examples in svelte kit app on this repo.

<StructuredText
	data={queryResult}
	components={{
		block: Span,
		QuoteRecord: Quote,
		DocPageRecord
	}}
/>

components attribute you can specify which component to render on element type returned in Dato CMS query.

"paragraph" | "heading" | "link" | "itemLink" | "inlineItem" | "block" | "list" | "listItem" | "blockquote" | "code" | "root" | "span" | "thematicBreak"

If you don't specify, clean and empty dom element will be used.

I'm working out how to publish the package to get rid of import problems afterwards.

for now it can be imported like this :

import StructuredText from 'svelte-datocms/StructuredText/StructuredText.svelte'

you can use also :

import SimpleStructuredText from 'svelte-datocms/StructuredText/SimpleStructuredText.svelte'

I have also prepared the Svelte repl
REPL example

Thank you @lukaszwisniewski88, with these info now my code works!!!