Skip to content

Instantly share code, notes, and snippets.

@josephfusco
Last active February 24, 2023 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephfusco/b781839e8c33dc729b64f94eaa8a57c3 to your computer and use it in GitHub Desktop.
Save josephfusco/b781839e8c33dc729b64f94eaa8a57c3 to your computer and use it in GitHub Desktop.
Testing the ToolbarNodeSkeleton component with Faust.js.
import React from 'react';
import { FaustHooks, FaustPlugin } from '@faustwp/core';
import { FaustToolbarNodes, ToolbarNodeSkeleton } from '@faustwp/core/toolbar';
export class CustomToolbar implements FaustPlugin {
apply(hooks: FaustHooks) {
hooks.addFilter('toolbarNodes', 'faust', (toolbarNodes: FaustToolbarNodes) => {
const customToolbarNodes: FaustToolbarNodes = [
{
id: 'test1',
location: 'primary',
component: <ToolbarNodeSkeleton />,
},
{
id: 'test2',
location: 'primary',
component: <ToolbarNodeSkeleton />,
},
];
return [...toolbarNodes, ...customToolbarNodes];
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment