drupal-composable
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Drupal-Composable

Provide delightful editorial experiences for content editors within Drupal regardless of your FE implementation.

Prerequisites

Make sure your Drupal site is used as CMS API first.

Usage

Importing library

import type { ComposableComponentProps} from "drupal-composable";
import { openComposableComponent } from "drupal-composable"

Usage: React

Creating your ComposableComponentContainer

interface ComposableComponentContainerProps extends ComposableComponentProps {
  children?: React.ReactNode;
}

const ComposableComponentContainer = ({ action, storage, uuid, children }: ComposableComponentContainerProps) => (
  <section
    data-composable-component={`${storage}-${uuid}`}
    onClick={() => openComposableComponent({
      action,
      storage,
      uuid,
    })}
  >
    {children}
  </section>
)

Using the new created React Component

  <ComposableComponentContainer
    action='edit'
    storage='paragraph'
    uuid={component.id}
  >
    {reactComponent}
  </ComposableComponentContainer>

Supporting organizations

Development sponsored by Octahedroid

Package Sidebar

Install

npm i drupal-composable

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

3.09 kB

Total Files

6

Last publish

Collaborators

  • jmolivas