Skip to content

Commit

Permalink
fix(openalex): Highlight selected affiliations in the list view
Browse files Browse the repository at this point in the history
  • Loading branch information
jerem1508 committed Nov 26, 2024
1 parent e7ae702 commit 55edc66
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions client/src/pages/openalex-ror/results/list-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export default function ListView({
<ul className="wm-list">
{
allAffiliations.map((affiliation) => (
<li key={affiliation.key}>
<li
className={selectedOpenAlex.some((a) => a.key === affiliation.key) ? 'selected' : ''}
key={affiliation.key}
>
<Row>
<Col>
<div style={{ display: 'inline-flex' }}>
Expand All @@ -54,7 +57,7 @@ export default function ListView({
}
</div>
<div className="fr-ml-1w" style={{ display: 'inline-block', maxWidth: '95%' }}>
<Text as="label" htmlFor={`affiliation-${affiliation.key}`} style={{ cursor: 'pointer' }}>
<Text as="span">
<div dangerouslySetInnerHTML={{ __html: affiliation.nameHtml.replace(' [ source: OpenAlex ]', '') }} />
</Text>
<WorksList works={affiliation.works} />
Expand Down
1 change: 0 additions & 1 deletion client/src/pages/openalex-ror/results/views-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export default function ViewsSelector({
<Col xs="3">
<Checkbox
checked={(selectedOpenAlex.length === filteredAffiliations.length) && (selectedOpenAlex.length > 0)}
className="fr-ml-2w"
onChange={() => {
if (selectedOpenAlex.length === 0) {
setSelectedOpenAlex(filteredAffiliations);
Expand Down
5 changes: 5 additions & 0 deletions client/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,16 @@ html, body {
background-color: #eee;
list-style: none;
border: #777 1px solid;
padding-left: 1px;

li {
padding: 10px;
border-bottom: 1px solid #ddd;
font-size: 0.9rem;

}
.selected {
background-color: #d7cdf1;
}
}

Expand Down

0 comments on commit 55edc66

Please sign in to comment.