-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Refactor code for covers #994
Conversation
Thanks @mouse-reeve. I do like the fact we know what variables we’re working with in a given file, so having the context repeated in the file seems good to me.
I do dislike the fact DTL does not allow for line-breaks and space management though, so I tend to not repeat the same variable in different places in the same file, hence the `{% with… %}` blocks. I also like to think about those blocks as a form of statement that says “Here, I want to work with that”.
|
- Avoid specifying context-dependent values in CSS for components. Those values can be defined by the context calling the component. - Use `<figure>` with optional caption. - Reduce redundant markup. - Allow more variables to be passed to the book-cover (image path and class for the container). - Hide the book cover to screen readers.
793cc97
to
9ea91d8
Compare
- Reduce Padding around covers. - Remove `content` which is applying too extensive default styles.
- Reduce Padding around covers. - Remove `content` which is applying too extensive default styles. - Style headings. - Replace table with definition list. - Clip cover container to avoid caption overflowing.
In your list of pages to screenshoot, I'd add (in |
Yep, |
Thanks! I was playing with the logged out
Yep! I’ve fixed this while updating templates… I’ll see what broke when I get to this page and if I need to do anything.
Added, thanks! |
Addresses bookwyrm-social#994 (comment).
- Have an explicit contextual class on `cover-container`. - Use more flexible, consistent and searchable variable name for passing classes to covers. - Consistently use `'…'` with django variables. - Give the option to not hide covers to screen readers. - consitently give a title to the cover container if `alt_text` exists. - [lists] Remove `.content` which is applying too extensive default styles.
Addresses bookwyrm-social#994 (comment).
7796396
to
cf5a4eb
Compare
- `optimizeQuality` > `smooth` (CSS language evolution) - Use `auto` instead of a fixed width. - Add exceptions for heights and apply them to some previously modified templates. - Remove `is-large` exception. - Widen the content column on list curation.
- Set minimum dimensions to avoid having to pass classes all over the place. - Outline the container to show white on white covers properly. - Remove extraneous code. - Better size caption when no cover is available. - Create Alignments, Positions and Spacings sections and move some existing dimensions. - Update previous templates.
- Work on feeds. - Add `.is-cover` to modify the behaviours of columns. - Only apply logic for dimensions on the cover container; too many contextual side effects otherwise. - Add classes to dimension and align, including auto margins for flex. - Rename classes in templates accordingly.
- Remove `.content` from templates. - Remove a stray unclosed label.
- Remove `.content` from template when not dealing with markdown-generated markup. - Fix some duplicated CSS selectors.
I think I updated all templates containing covers and they seem to be fine, from the screenshots I took and the tests I did. I’ll have another round of reading after a night of sleep, then I’ll submit the Review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is ready enough. I’m opening it to review; let’s see… :)
Better view the whitespace-free version.
Here is my goodreads_library_export.csv, in case you’d just want to run the script for screenshots with a fresh DB.
I tried to understand what the current rules about the book-cover were doing, then I tried to make it a more resilient component. It is not perfect; maybe the dimensional constraints could be handled by flex-direction
and flex
instead of fixed dimensions, but I think the changes work well enough for now.
- The container to be flexible enough by composing with other classes, to align its content inside it if necessary, or just adapts to its content based on its context.
- The column following a
.is-cover
column will regain access to an automaticflex-basis
, allowing it to resize its main axis. - Generally, I think the
<a>
around the covers should better be within the container. For example, adding a button in the container is impossible with the current DOM tree.
There were a couple of existing issues that also prompted this PR:
- Discover was sort of broken.
- Book was cropping covers that are not vertical.
- The content beside the cover was not always aligned if the covers are not all the same width.
- Spacings sometimes felt odd. (Some still do. :) )
- Columns were using a lot of extra padding.
.content
is used in many places for content that is not markdown-generated, causing unwanted side-effects.
Some Before / After
Author with one book
Author with multiple books
Editions with varying sized or missing covers
Lists with varying sized covers
Cropped content
Reading process
Clipped covers on Book
Funky Discover
Book editing
I took the opportunity to fix the horizontal scrolling for the getting started modal:
A few other untouched weirdnesses
Getting started on a tiny screen:
Import needs some table love on narrow screens:
What @joachimesque did on the User Books works. :)
There… That’s a lot. Thank you. :)
<th></th> | ||
</tr> | ||
|
||
<dl> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joachimesque: I implemented the list I mentioned in the past. I think it works fine but I can replace it with a table if need be.
From my experience doing both German and French localisation, total localised text length is mostly smaller in German than in French (German, a language devoid of most niceties, can be pretty terse; compare „Rauslehnen verboten“ with « Interdiction de se pencher »). The biggest issue are the bloodylongcompositewords German contains, which cause problems with reflow (you’d need automated hyphenation) and truncation (there are rules for correct truncation in German, but again, no automated support AFAIK). |
@arkhi agreed! apologies for the merge conflicts, otherwise I'm happy to merge |
@kopischke: I had been seeing some of those bloodylongcompositewords issues during my (very quick) study of German and working for a German website, so I was taking this case into account more than basing my comment on any accurate knowledge of the language. I hope you didn’t get offended as mockery was not my intention; I’m mostly trying to think about the worst case scenarii if possible and German composite words were what popped in my mind. Thanks for the feedback; it’s good to learn a bit more. :) In our specific case, I don’t believe line truncation on buttons would really work (I’d go for hiding text overflow and ellipsis), but a rework of the interface could be a first step to avoid hiding any text at all. |
@arkhi No worries there; I very much appreciate the BookWyrm project’s awareness of these issues (the discussion on gender neutral French forms I found illuminating in how it mirrors many of our own – I was pretty much only aware of the point médian until then). |
No need to apologise. Part of the conflicts came from me formatting templates further than I should; my responsibility. :) I’m very happy about the inclusion of inventaire.io in the mix and the simplified display of author[ (date)]! |
The goal of this PR is to reduce the complexity of the code for covers, and try to use a component-style approach because it is used in many places.
I might be going a bit heavy handed here, but that will help to actually understand the project better.
One of the goals is to remove classes like
.is-large
and use responsive images instead.This PR will probably conflict with #971, but that’s fine when it will. :)
I will be using this script to generate screenshots with pageres along the way, to make sure (as much as possible) I am not breaking anything. I identified some URLs where a book cover would appear and I hope I am not missing too many. Let me know if that’s the case.