1.0.0 • Published 4 years ago

@fantassin/beacon v1.0.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
4 years ago

Fantassin Beacon

Installation

Use the package manager npm to install the Beacon.

npm i @fantassin/beacon -D

Usage

By default the Beacon is empty.

If you want to add some sections you have to install @wordpress/hooks package.

npm i @wordpress/hooks -D

Then you can customize your sections with React Components like this :

import { addFilter } from @wordpress/hooks;
import YourComponent from './your-component-folder';

function exampleSection( sections ){
	let newSection = {
		name: 'section-key',
		tabLabel: 'Section name',
		content: <YourComponent />,
	}
	return [ ...sections, newSection ];
}

addFilter( 'fantassin.beacon.getSections', 'your_namespace', exampleSection );

When you want to display the Beacon you can enqueue build/index.js in you HTML file like this :

<script src="build/index.js"></script>