Enforce a readable line length for Read More #3442
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changed
Before:
After (Ignore the slight differences in metadata, my prod server has Kavita+ and Komf alimenting it):
Review cards:
Usually, for longer texts, readability suffers with lines over 75 characters on desktop (On mobile, that's around 50 characters).
To make sure descriptions stay readable, the contents of the read-more component are now capped to a line length of 75 characters on larger breakpoints and 50 characters on smaller breakpoints.
I'm keeping this PR as a draft for now, because I need to adjust the cutoff limits for the various uses of the component. I'm generally trying to keep the number of lines similar to the current one, to not break design. It sacrifices the amount of content that's readable without expanding, but I feel like preserving alignment is much better than having 5+ lines of text shown on load.
Edit: Forgot a source for the length thing: https://baymard.com/blog/line-length-readability
Edit 2: This is now ready for review.
One thing I noticed while adjusting the cutoff, there's often an overflow on the review cards when reviews have line returns. I lowered the cutoff a bit (The max-width doesn't do anything for these, so I can omit this if you prefer), which fixes the overflow in some cases, but there should probably be some server-size cleanup of empty lines and such (Especially since we'll likely want to let clients decide how to display them, including the distance between paragraphs, so returning straight paragraphs separated by one \n seems like the best solution). In any case, that's for another PR some day, but I figured I'd raise it while I'm seeing it.