Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
refactor: use links to navigate to library detail
Browse files Browse the repository at this point in the history
Makes the library card in the library list page, which navigate to a
different page on click, to appear as links i.e. making the navigation
address visible on hover.

closes #414

- Signed-off by: Ishan Masdekar <[email protected]>
  • Loading branch information
imasdekar committed May 31, 2024
1 parent d91d4de commit e33ff83
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/library-authoring/list-libraries/LibraryListPage.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import {Link} from 'react-router-dom';

Check failure on line 2 in src/library-authoring/list-libraries/LibraryListPage.jsx

View workflow job for this annotation

GitHub Actions / tests

A space is required after '{'

Check failure on line 2 in src/library-authoring/list-libraries/LibraryListPage.jsx

View workflow job for this annotation

GitHub Actions / tests

A space is required before '}'
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
Breadcrumb, Button, Pagination, ActionRow, Card,
Breadcrumb, Button, Pagination, ActionRow, Card

Check failure on line 6 in src/library-authoring/list-libraries/LibraryListPage.jsx

View workflow job for this annotation

GitHub Actions / tests

Missing trailing comma
} from '@openedx/paragon';
import { Add } from '@openedx/paragon/icons';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
Expand Down Expand Up @@ -70,10 +71,6 @@ export class LibraryListPage extends React.Component {
});
};

goToLibraryItem = (library) => {
this.props.navigate(library.url);
};

renderError() {
const { intl, errorMessage } = this.props;

Expand Down Expand Up @@ -141,10 +138,11 @@ export class LibraryListPage extends React.Component {
<ul className="list-unstyled">
{libraries.data.map(library => (
<Card
as={Link}
isClickable
key={library.id}
className="library-item mt-2 p-1"
onClick={() => this.goToLibraryItem(library)}
to={library.url}
>
<Card.Section title={<h4 className="text-primary-500">{library.title}</h4>}>
<span className="small text-gray-500">
Expand Down

0 comments on commit e33ff83

Please sign in to comment.