Skip to content

Commit

Permalink
refactor(sidemenu): add is_in_path and is_current attributes for an a…
Browse files Browse the repository at this point in the history
…ctive example
  • Loading branch information
tarantilis committed Oct 5, 2022
1 parent 594b63e commit a3fe7fd
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/ui/ContextNavigation/ContextNavigation.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const sidenavItems = [
review_state: null,
title: 'Summer 2022: Living in a state of multiple crises',
url: '/#',
is_current: true,
},
{
'@id': 'article-2',
Expand All @@ -94,6 +95,7 @@ const sidenavItems = [
review_state: null,
title: 'Articles',
url: '/#',
is_in_path: true,
},
{
'@id': 'Infographics-overview',
Expand All @@ -107,6 +109,7 @@ const sidenavItems = [
review_state: null,
title: 'Infographics',
url: '/#',
is_in_path: true,
},
];

Expand All @@ -119,7 +122,14 @@ function Template({ ...args }) {
{args.sidenavItems &&
args.sidenavItems.map((element, index) => {
return (
<div role="listitem" className="item level-1">
<div
role="listitem"
className={
(element.is_current ? 'active ' : '') +
(element.is_in_path ? 'in_path ' : '') +
'item level-1'
}
>
<div className="content">
<a
title={element.title}
Expand All @@ -132,7 +142,14 @@ function Template({ ...args }) {
element.items.map((subelement, index) => {
return (
<div className="list" role="list">
<div role="listitem" className="item level-2">
<div
role="listitem"
className={
(subelement.is_current ? 'active ' : '') +
(subelement.is_in_path ? 'in_path ' : '') +
'item level-2'
}
>
<div className="content">
<a
title={subelement.title}
Expand All @@ -148,7 +165,11 @@ function Template({ ...args }) {
<div className="list" role="list">
<div
role="listitem"
className="item level-3"
className={
(subparelement.is_current
? 'active '
: '') + 'item level-3'
}
>
<div className="content">
<a
Expand Down

0 comments on commit a3fe7fd

Please sign in to comment.