Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix styling of book info page #45

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 23 additions & 13 deletions frontend/src/pages/Book.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import './book.scss';
import { useParams } from 'react-router-dom';

import { bookURL } from '../SERVER';

export default function Book() {
Expand All @@ -21,17 +21,27 @@ export default function Book() {
}, []);

return (
<>
<h2 className="PageTitle">{book.title}</h2>
<dl>
<dt>author</dt>
<dd>{book.author}</dd>
<dt>genre</dt>
<dd>{book.genre}</dd>
<dt>year</dt>
<dd>{book.yearPublished}</dd>
</dl>
<img src={`https://picsum.photos/200/300`} alt="book cover" width={200} height={300} />
</>
<section className="Section">
<div className="Section__row">
<h2 className="PageTitle">{book.title}</h2>
<div className="BookDetails">
<img src={`https://picsum.photos/500/500`} alt="book cover" width={500} height={500} />
</div>
<div className="BookDetails">
<dl>
<dt>title</dt>
<dd>{book.title}</dd>
<dt>author</dt>
<dd>{book.author}</dd>
<dt>genre</dt>
<dd>{book.genre}</dd>
<dt>year</dt>
<dd>{book.yearPublished}</dd>
</dl>
</div>
<button className="Button Button__back">go back</button>
<button className="Button Button__add">add to list</button>
</div>
</section>
);
}
65 changes: 65 additions & 0 deletions frontend/src/pages/book.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@import '../fonts/fontWeight.scss';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't really like the floats and % unit
i would also like you to change the px unit into em, em is a unit scaled on the current font-size

.PageTitle {
margin: 0 0 1.25em ;
font: $regular 2.25em/1.5 'Quicksand', sans-serif;
text-transform: uppercase;
}

.Section {
padding: 2em;

&__row::after {
content: "";
clear: both;
display: table;
}
}

.BookDetails {
float: left;
text-align: center;
width: 40em;

dt {
float: left;
clear: left;
width: 5em;
text-align: right;
text-transform: uppercase;
font: $regular 1.5em/1.5 'Quicksand', sans-serif;
}

dt::after {
content: ":";
}

dd {
margin: 0.5em;
//padding-left: 0.5em;
padding: 0 0 3.5em 0;
font-style: 'Quicksand', sans-serif;
font-size: larger;
}
}

.Button {
border: none;
color: white;
padding: 0.5em ;
text-align: center;
font-size: 1.5em;
margin: 0 2em;
display: inline-block;
text-transform: uppercase;
cursor: pointer;
border-radius: 0.5em;

&__back {
background-color: #db5127;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shinh18 : both buttons have the same rules applied, except for the background, you could put everything in common and add two classes on your HTML element, one for the common aspect and one for the specific rule

&__add {
background-color: #3e8e41;
}
}