+ {menuItems.length > 0 ?
+
+
+ {menuItems.map(({anchor, content}) => (
+ -
+
+ {content}
+
+
+ ))}
+
+
:
+
+ {__('There are not any pre-established headings that this block can display in the form of a secondary navigation menu. Please add headings to your page.', 'planet4-blocks-backend')}
+
+ }
+
+ );
+};
+
+export const SecondaryNavigationEditor = ({attributes, isSelected}) => (
+ <>
+ {isSelected && renderEdit()}
+ {renderView(attributes)}
+ >
+);
diff --git a/assets/src/blocks/SecondaryNavigation/SecondaryNavigationFrontend.js b/assets/src/blocks/SecondaryNavigation/SecondaryNavigationFrontend.js
new file mode 100644
index 0000000000..26d399ab83
--- /dev/null
+++ b/assets/src/blocks/SecondaryNavigation/SecondaryNavigationFrontend.js
@@ -0,0 +1,32 @@
+import {getHeadingsFromDom} from '../TableOfContents/getHeadingsFromDom';
+
+export const SecondaryNavigationFrontend = ({levels}) => {
+ const headings = getHeadingsFromDom(levels);
+ const setActive = event => {
+ const allLinks = document.querySelectorAll('.secondary-navigation-link');
+ allLinks.forEach(link => link.classList.remove('active'));
+ event.target.classList.add('active');
+ };
+
+ return (
+