-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suporte a mapa do site no rodapé (Fixes #2)
- Loading branch information
Showing
5 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Suporte a exibição do mapa do site no rodapé [@ericof] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
frontend/packages/portalbrasil-intranet/src/components/Footer/Sitemap.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { useEffect } from 'react'; | ||
import { useDispatch, useSelector, shallowEqual } from 'react-redux'; | ||
import { NavLink } from 'react-router-dom'; | ||
import { getNavigation } from '@plone/volto/actions'; | ||
import { GridList, GridListItem } from '@plone/components'; | ||
import { getBaseUrl, hasApiExpander } from '@plone/volto/helpers'; | ||
import config from '@plone/volto/registry'; | ||
|
||
const Sitemap = ({ pathname }) => { | ||
const dispatch = useDispatch(); | ||
const token = useSelector((state) => state.userSession.token, shallowEqual); | ||
const items = useSelector((state) => state.navigation.items, shallowEqual); | ||
|
||
useEffect(() => { | ||
if (!hasApiExpander('navigation', getBaseUrl(pathname))) { | ||
dispatch(getNavigation(getBaseUrl(pathname), config.settings.navDepth)); | ||
} | ||
}, [pathname, token, dispatch]); | ||
|
||
return ( | ||
<nav id="footer-navigation" aria-label="navigation" className="navigation"> | ||
<GridList className={'navigation-grid'}> | ||
{items.map((item, index) => ( | ||
<GridListItem key={item.url} className={'navigation-item'}> | ||
<h3 className={'section'}> | ||
<NavLink to={item.url}>{item.title}</NavLink> | ||
</h3> | ||
{item.items && item.items.length > 0 && ( | ||
<ul className={'item-wrapper'}> | ||
{item.items.map((subitem) => ( | ||
<li key={subitem.url} className={'nav-subitem'}> | ||
<NavLink to={subitem.url}>{subitem.title}</NavLink> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</GridListItem> | ||
))} | ||
</GridList> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default Sitemap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters