fix selected section

This commit is contained in:
paul sealock 2024-06-04 13:28:29 +12:00
parent 094fa28f90
commit 2c8783e8ad
1 changed files with 2 additions and 5 deletions

View File

@ -12,10 +12,7 @@ import classnames from 'classnames';
export const SectionNav = ( { data, section } ) => {
const { sections } = data;
const sectionKeys = Object.keys( sections );
if ( sectionKeys.length === 1 ) {
return null;
}
const selectedSection = section || sectionKeys[ 0 ];
return (
<>
@ -24,7 +21,7 @@ export const SectionNav = ( { data, section } ) => {
<Item
key={ key }
className={ classnames( {
'active-section': section === key,
'active-section': selectedSection === key,
} ) }
>
<Button