Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

arzidava/svelte-portable-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☣️ Deprecated

This package is deprecated and archived in favour of the official package that has been released https://github.com/portabletext/svelte-portabletext/

Portable Text for Svelte

Provides a way to render Portable Text in Svelte applications.

Install

npm add --save-dev @arzidava/svelte-portable-text

Usage

<script>
  import BlockContent from "@arzidava/svelte-portable-text";

  import Image from "./Image";
  import Link from "./Link";

  export let content;
  export const customSerializers = {
    types: {
      image: props => {
        return {
          component: Image,
          props: {
            url: props.node.url,
          },
        };
      },
    },
    marks: {
      link: props => {
        return {
          component: Link,
          props: props.mark,
        };
      },
    },
  };
</script>

<BlockContent blocks="{content}" serializers="{customSerializers}" />

Work in Progress

This package is under development but should cover the most basic usages. A demo setup of this package using Sanity can be found here.

If you find bugs, just open an issue (or even better a Pull Request) 😀

About

Portable Text for Svelte

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published