npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jahia/nextjs-community-components

v0.0.13

Published

The aim of the Jahia Nextjs initiative is to explore and explain the Jahia capabilities to easily create and manage headless web project. Solutions we use are : - [Jahia][jahia-website] : a Cloud / On-premise *DXP* solution to create and contribute - [Ver

Downloads

20

Readme

The Jahia Nextjs initiative : jahia community components for Nextjs

The aim of the Jahia Nextjs initiative is to explore and explain the Jahia capabilities to easily create and manage headless web project. Solutions we use are :

  • Jahia : a Cloud / On-premise DXP solution to create and contribute
  • Vercel a next-js Cloud platform provider to render the web project

To know more about the Jahia Nextjs initiative read this dedicated page.

Why this community components ?

Use this package in Nextjs headless project:

  • to add pre-build react components to render legacy jahia modules like Bootstrap grid or Animate
  • and much more

Installation

The community components is available as an npm package. To install it in a project, run one of this command :

# with npm
npm install @jahia/nextjs-community-components

# with yarn
yarn add @jahia/nextjs-community-components

To know more about the full configuration of a project using Jahia and Nextjs read the setup.

Components

|Name|Props|Description| |---|---|---| |BS4Grid| id |This component is used to render the content type bootstrap4nt:grid coming from the boostrap 4 Jahia module.| |ContentRetrieval| id |This component is the default view to render the content type jnt:contentRetrieval coming from the Jahia Content retrieval (contentRetrieval) module.| |IsotopeContentRetrieval| id |This component is the isotope view to render the content type jnt:contentRetrieval coming from the Jahia Content retrieval (contentRetrieval) module. By default the component expect that the child node has a view isotope registered.|

GraphQL helper function

The module exports the useNavMenu function, which resumes in one line the GraphQL call needed to get navigation menu properties.

typescript signature:

const useNavMenu = ({id}:ComponentPropsType)

Example of usage

Let consider you want to create a navBar for the header part of your site. You create a new jnt:navMenuNext aka Navigation Menu (provided by the nextjs-proxy module).

To retrieve the nodes of your navBar in your React component, use the useNavMenu() function as follows:

import {useNavMenu} from '@jahia/nextjs-community-components';

export function NavMenuHeader({id}) {
    const {data: navTree, loading, error} = useNavMenu({id});
    ...
}

This function returns a data object (renamed navTree in the example above) with as set of properties :

  • navMenuTitle: the title of your navBar
  • children: the list of page nodes below the base node (starting point) or the set of pages defined by the user

The function returns also for each node, including the base node, the core properties accessible directly from the data object:

  • uuid: unique id of the content
  • path: path of the content in the content tree
  • name: technical name of the content
  • primaryNodeType.name: type of content
  • mixinTypes[{name}]: name of the mixins associated to the content
  • view: name of the component to call to render the content
  • page: boolean set to true if the child node is a page (could be a label)
  • title: title of the page in the appropriate language