projectblacklight / arclight

A Rails engine supporting discovery of archival material
https://samvera.atlassian.net/wiki/spaces/samvera/pages/405211890/ArcLight
Other
39 stars 26 forks source link

Replace responsiveTruncate with pure CSS #1091

Closed jcoyne closed 2 years ago

jcoyne commented 2 years ago

https://css-tricks.com/line-clampin/

thatbudakguy commented 2 years ago

last time i looked, all of the pure css solutions still required knowing the number of lines beforehand. it looks like we don't know that: https://github.com/projectblacklight/arclight/blob/809c34b30505145b5c12260ee0e3e1f9290ae273/vendor/assets/javascripts/responsiveTruncator.js#L25

if there is (finally!) a good solution that avoids that problem, I'd love to learn it!

marlo-longley commented 2 years ago

Question after discussing with @thatbudakguy: can we set the number of lines in stone based on the best UI, and dictate that to CSS line clamp? Would involve consulting with Gary on UI.

thatbudakguy commented 2 years ago

also for reference: marlo implemented a mixin to do this on DLME using the -webkit-line-clamp strategy, which works provided we know the desired number of lines to clamp to beforehand.

need to figure out how it interacts with the show/hide button, though.

jcoyne commented 2 years ago

@thatbudakguy we currently clamp everything here to 3 lines: https://github.com/projectblacklight/arclight/blob/main/app/assets/javascripts/arclight/responsiveTruncator.js#L18

Is that what you were asking?

thatbudakguy commented 2 years ago

oh — yep, it is. if it's always 3, that makes it easy!