Skip to content

Commit

Permalink
Link to author from book details
Browse files Browse the repository at this point in the history
Co-authored-by: plmcgrn <889547+plmcgrn@users.noreply.github.com>

Closes #3356
  • Loading branch information
mynameisbogdan committed Mar 15, 2024
1 parent 93ee466 commit b8c2957
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions frontend/src/Author/AuthorNameLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import PropTypes from 'prop-types';
import React from 'react';
import Link from 'Components/Link/Link';

function AuthorNameLink({ titleSlug, authorName }) {
function AuthorNameLink({ titleSlug, authorName, ...otherProps }) {
const link = `/author/${titleSlug}`;

return (
<Link to={link}>
<Link to={link} {...otherProps}>
{authorName}
</Link>
);
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/Book/Details/BookDetailsHeader.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@
font-size: 20px;
}

.authorLink {
composes: link from '~Components/Link/Link.css';

margin-right: 15px;
color: var(--white);
}

.duration {
margin-right: 15px;
margin-left: 10px;
}

.detailsLabel {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/Book/Details/BookDetailsHeader.css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Please do not change this file!
interface CssExports {
'alternateTitlesIconContainer': string;
'authorLink': string;
'backdrop': string;
'backdropOverlay': string;
'cover': string;
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/Book/Details/BookDetailsHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import moment from 'moment';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import TextTruncate from 'react-text-truncate';
import AuthorNameLink from 'Author/AuthorNameLink';
import BookCover from 'Book/BookCover';
import HeartRating from 'Components/HeartRating';
import Icon from 'Components/Icon';
Expand Down Expand Up @@ -113,7 +114,7 @@ class BookDetailsHeader extends Component {
className={styles.monitorToggleButton}
monitored={monitored}
isSaving={isSaving}
size={isSmallScreen ? 30: 40}
size={isSmallScreen ? 30 : 40}
onPress={onMonitorTogglePress}
/>
</div>
Expand All @@ -131,7 +132,12 @@ class BookDetailsHeader extends Component {
</div>

<div>
{author.authorName}
<AuthorNameLink
className={styles.authorLink}
titleSlug={author.titleSlug}
authorName={author.authorName}
/>

{
!!pageCount &&
<span className={styles.duration}>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/Components/HeartRating.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
margin-right: 5px;
color: var(--themeRed);
}

.rating {
margin-right: 15px;
}
1 change: 1 addition & 0 deletions frontend/src/Components/HeartRating.css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Please do not change this file!
interface CssExports {
'heart': string;
'rating': string;
}
export const cssExports: CssExports;
export default cssExports;
2 changes: 1 addition & 1 deletion frontend/src/Components/HeartRating.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from './HeartRating.css';

function HeartRating({ rating, iconSize }) {
return (
<span>
<span className={styles.rating}>
<Icon
className={styles.heart}
name={icons.HEART}
Expand Down

0 comments on commit b8c2957

Please sign in to comment.