Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-web
ensembl-client
Commits
8af5b60e
Unverified
Commit
8af5b60e
authored
Aug 13, 2021
by
Andrey Azov
Committed by
GitHub
Aug 13, 2021
Browse files
Use related articles for About pages (#550)
parent
e9b90331
Pipeline
#184303
passed with stages
in 4 minutes and 33 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
9 deletions
+29
-9
src/ensembl/src/content/app/about/About.tsx
src/ensembl/src/content/app/about/About.tsx
+14
-5
src/ensembl/src/shared/components/help-article/HelpArticle.scss
...sembl/src/shared/components/help-article/HelpArticle.scss
+4
-0
src/ensembl/src/shared/components/help-article/RelatedArticles.tsx
...bl/src/shared/components/help-article/RelatedArticles.tsx
+11
-4
No files found.
src/ensembl/src/content/app/about/About.tsx
View file @
8af5b60e
...
...
@@ -21,6 +21,7 @@ import useApiService from 'src/shared/hooks/useApiService';
import
{
TextArticle
,
RelatedArticles
,
HelpArticleGrid
}
from
'
src/shared/components/help-article
'
;
import
{
...
...
@@ -59,11 +60,19 @@ const About = () => {
</
div
>
)
}
<
aside
className
=
{
styles
.
aside
}
>
{
menu
&&
(
<>
<
div
className
=
{
styles
.
asideTitle
}
>
More about...
</
div
>
<
SideMenu
menu
=
{
menu
}
currentUrl
=
{
location
.
pathname
}
/>
</>
{
article
?.
related_articles
.
length
?
(
<
RelatedArticles
title
=
"More about…"
articles
=
{
article
.
related_articles
}
highlightActiveArticle
=
{
true
}
/>
)
:
(
menu
&&
(
<>
<
div
className
=
{
styles
.
asideTitle
}
>
More about…
</
div
>
<
SideMenu
menu
=
{
menu
}
currentUrl
=
{
location
.
pathname
}
/>
</>
)
)
}
</
aside
>
</
HelpArticleGrid
>
...
...
src/ensembl/src/shared/components/help-article/HelpArticle.scss
View file @
8af5b60e
...
...
@@ -158,3 +158,7 @@ $textColumnWidth: 450px;
fill
:
white
;
}
}
.relatedArticleActive
{
color
:
$black
;
}
src/ensembl/src/shared/components/help-article/RelatedArticles.tsx
View file @
8af5b60e
...
...
@@ -16,7 +16,9 @@
import
React
from
'
react
'
;
import
{
useDispatch
}
from
'
react-redux
'
;
import
{
useLocation
}
from
'
react-router-dom
'
;
import
{
push
}
from
'
connected-react-router
'
;
import
classNames
from
'
classnames
'
;
import
{
ReactComponent
as
VideoIcon
}
from
'
static/img/shared/video.svg
'
;
...
...
@@ -27,10 +29,12 @@ import styles from './HelpArticle.scss';
type
Props
=
{
articles
:
RelatedArticleData
[];
title
?:
string
;
highlightActiveArticle
?:
boolean
;
onArticleClick
?:
(
article
:
RelatedArticleData
)
=>
void
;
};
const
RelatedArticles
=
(
props
:
Props
)
=>
{
const
location
=
useLocation
();
const
dispatch
=
useDispatch
();
const
onArticleClick
=
(
article
:
RelatedArticleData
)
=>
{
...
...
@@ -42,10 +46,13 @@ const RelatedArticles = (props: Props) => {
};
const
relatedArticles
=
props
.
articles
.
map
((
relatedArticle
)
=>
{
const
relatedItemClassName
=
relatedArticle
.
type
===
'
article
'
?
styles
.
relatedArticle
:
styles
.
relatedVideo
;
const
relatedItemClassName
=
classNames
({
[
styles
.
relatedArticle
]:
relatedArticle
.
type
===
'
article
'
,
[
styles
.
relatedVideo
]:
relatedArticle
.
type
===
'
video
'
,
[
styles
.
relatedArticleActive
]:
props
.
highlightActiveArticle
&&
relatedArticle
.
url
===
location
.
pathname
});
return
(
<
a
href
=
{
relatedArticle
.
url
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment