From badfe691de74d3aad2756da7b47e7acd5d9dd3be Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 2 Nov 2023 10:07:49 -0600 Subject: [PATCH] Using css ellipsis for download rows. --- app/src/App.css | 18 +++++++++++++- app/src/components/Archive.js | 7 +++--- app/src/components/Common.js | 18 +++++++------- app/src/components/Download.js | 4 ++-- app/src/components/Files.js | 9 ++++--- app/src/components/Videos.js | 3 +-- app/src/components/admin/Downloads.js | 34 +++++++++++++-------------- 7 files changed, 53 insertions(+), 40 deletions(-) diff --git a/app/src/App.css b/app/src/App.css index 64b417f5..373c0895 100644 --- a/app/src/App.css +++ b/app/src/App.css @@ -207,4 +207,20 @@ textarea.otp { .inverted label { color: #DDDDDD !important; -} \ No newline at end of file +} + +.table-ellipsis td.column-ellipsis { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 0; /* Ensures the content doesn't exceed the cell's width */ + min-width: 0; /* Can be set to ensure a minimum width for your cells, if needed */ +} + +.card-title-ellipsis { + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/app/src/components/Archive.js b/app/src/components/Archive.js index a1b4fbdd..d456b221 100644 --- a/app/src/components/Archive.js +++ b/app/src/components/Archive.js @@ -19,7 +19,6 @@ import { APIButton, BackButton, CardLink, - cardTitleWrapper, encodeMediaPath, ErrorMessage, ExternalCardLink, @@ -289,14 +288,14 @@ export function ArchiveCard({file}) { - - {cardTitleWrapper(file.title || data.url)} + + {file.title || data.url} {domain && -

{domain}

+ {domain}
}

diff --git a/app/src/components/Common.js b/app/src/components/Common.js index 815b0658..d457d862 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -199,10 +199,17 @@ export function CardLink({to, newTab = false, ...props}) { } -export function ExternalCardLink({to, ...props}) { +export function ExternalCardLink({to, children, ...props}) { const {t} = useContext(ThemeContext); - return - {props.children} + return + {children} } @@ -1184,11 +1191,6 @@ export const toLocaleString = (num, locale = 'en-US') => { return num.toLocaleString(locale); } -export const cardTitleWrapper = (title, maxLength = 100, breakWord = true) => { - const style = breakWord ? {overflowWrap: 'break-word'} : null; - return {textEllipsis(title, maxLength)} -} - function luma(color) { let rgb = (typeof color === 'string') ? hexToRGBArray(color) : color; return (0.2126 * rgb[0]) + (0.7152 * rgb[1]) + (0.0722 * rgb[2]); // SMPTE C, Rec. 709 weightings diff --git a/app/src/components/Download.js b/app/src/components/Download.js index 69dddb5d..92a84472 100644 --- a/app/src/components/Download.js +++ b/app/src/components/Download.js @@ -368,7 +368,7 @@ class RSSDownload extends ChannelDownload { in the future. ); - return

+ return
RSS Feed