1.2.6 • Published 2 years ago

@stnew/prismic-nextjs v1.2.6

Weekly downloads
1
License
MIT
Repository
-
Last release
2 years ago

@stnew/prismic-nextjs

@stnew/prismic-nextjs has peerDepenendencies of react, react-dom, and next. This package assumes you have a basic Next.js app running and have integrated the Prismic client.

This package exports:

  • PrismicLink - A wrapper for next/link that handles link resolution.
  • urlResolver from @stnew/prismic (npm)
  • PrismicContext, PrismicProvider, SliceZone, usePrismic, useHtmlSerializer, serializeElements from @stnew/prismic-react (npm)

PrismicLink

The PrismicLink component will take a Prismic link fragment and generate an anchor tag. It's using linkResolver and hrefResolver under the hood, so if you links are not working make sure that you have those set up correctly.

import { PrismicLink } from '@stnew/prismic-nextjs'

function NavItem({ link, label }) {
  return (
    <li>
      <PrismicLink link={link}>{label}</PrismicLink>
    </li>
  )
}
PropRequiredTypeDescription
linkYesPrismicDoc fragmentResolves urls for Prismic "Link" fields
asNoReact Component or stringRenders the a tag as another React component, useful for libraries like styled-components
urlObjectNoUrlObjectTransforms URL object and appends it to the URL, useful for things like query strings. This won't work on external links.

Styling PrismicLink

If you're using a css-in-js library like styled-components, you might be wondering how you can style a PrismicLink.

There are a few ways which we've outlined in this doc, for brevity.

1.2.6

2 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.1

3 years ago

1.1.0

4 years ago

1.1.0-beta.7

4 years ago

1.1.0-beta.6

4 years ago

1.1.0-beta.5

4 years ago

1.1.0-beta.4

4 years ago

1.1.0-beta.3

4 years ago

1.1.0-beta.2

4 years ago

1.1.0-beta.1

4 years ago

1.1.0-beta.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-alpha.4

4 years ago

1.0.0-alpha.3

4 years ago

1.0.0-alpha.2

4 years ago

1.0.0-alpha.1

4 years ago

1.0.0-alpha.0

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.5.0

4 years ago

0.6.0

4 years ago

0.4.2

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.1-alpha.0

4 years ago