{content.title}
+ {content.description && ( +{content.description}
+ )} +diff --git a/packages/policy/src/index.js b/packages/policy/src/index.js index 51562a3..c3ac63d 100644 --- a/packages/policy/src/index.js +++ b/packages/policy/src/index.js @@ -4,6 +4,7 @@ const applyConfig = (config) => { // glossary tooltips config.settings.glossary.caseSensitive = false; config.settings.glossary.matchOnlyFirstOccurence = false; + config.settings.glossary.showAlphabetNavigation = true; // Tooltips everywhere config.settings.appExtras = [ diff --git a/packages/volto-slate-glossary/news/11.feature b/packages/volto-slate-glossary/news/11.feature index f7b92bd..1b733bc 100644 --- a/packages/volto-slate-glossary/news/11.feature +++ b/packages/volto-slate-glossary/news/11.feature @@ -1,3 +1 @@ -When viewing a Glossary, show an alphabet at the top. -Clicking a letter scrolls the entries for that letter into view. -@mauritsvanrees +Show an alphabet navigation on glossary. Clicking a letter scrolls the entries for this letter into view. @mauritsvanrees diff --git a/packages/volto-slate-glossary/src/components/GlossaryView.jsx b/packages/volto-slate-glossary/src/components/GlossaryView.jsx index 68f4601..8f854ae 100644 --- a/packages/volto-slate-glossary/src/components/GlossaryView.jsx +++ b/packages/volto-slate-glossary/src/components/GlossaryView.jsx @@ -1,9 +1,15 @@ import React from 'react'; import { Link } from 'react-router-dom'; +import { Container } from 'semantic-ui-react'; import { useSelector, useDispatch } from 'react-redux'; +import cx from 'classnames'; import { getGlossaryTerms } from '../actions'; +import config from '@plone/volto/registry'; const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; +const showAlphabetNavigation = + config.settings?.glossary?.showAlphabetNavigation || true; + const GlossaryView = ({ content }) => { const dispatch = useDispatch(); const pathname = useSelector((state) => state.router.location.pathname); @@ -12,41 +18,49 @@ const GlossaryView = ({ content }) => { dispatch(getGlossaryTerms()); }, [dispatch, pathname]); - let glossaryentries = useSelector( + const glossaryentries = useSelector( (state) => state.glossaryterms.result.items, ); + const lettersWithTerm = Object.keys(glossaryentries || {}); return ( -
{content.description}
- )} +{content.description}
+ )} +