From de507094ed4ae27f50867cad2892fc567e48c735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cintia=20S=C3=A1nchez=20Garc=C3=ADa?= Date: Wed, 23 Oct 2024 10:02:05 +0200 Subject: [PATCH] Improve how title ellipsis is displayed on grid view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cintia Sánchez García --- .../explore/grid/GridCategory.module.css | 32 +++++++++++++++---- ui/webapp/src/layout/explore/grid/index.tsx | 25 ++++++++++++--- ui/webapp/src/utils/detectIfSafari.ts | 5 +++ 3 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 ui/webapp/src/utils/detectIfSafari.ts diff --git a/ui/webapp/src/layout/explore/grid/GridCategory.module.css b/ui/webapp/src/layout/explore/grid/GridCategory.module.css index 7c2cc2fb..b8adee2b 100644 --- a/ui/webapp/src/layout/explore/grid/GridCategory.module.css +++ b/ui/webapp/src/layout/explore/grid/GridCategory.module.css @@ -1,15 +1,34 @@ -.catTitle { - writing-mode: vertical-rl; - text-orientation: mixed; - transform: rotate(180deg); +.catTitleTextWrapper { width: 3rem; + min-height: 137px; font-size: 0.7rem; line-height: 0.95rem; padding: 1rem 0rem; } -.catTitleText { - max-height: 130px; +.catTitle { + top: 0.5rem; + left: 7px; + height: 110px; + width: 30px; + -moz-transform: scale(-1, -1); + -webkit-transform: scale(-1, -1); + -o-transform: scale(-1, -1); + -ms-transform: scale(-1, -1); + transform: scale(-1, -1); + writing-mode: vertical-rl; + text-orientation: mixed; +} + +.safariTitle { + writing-mode: vertical-rl; + text-orientation: mixed; + width: 30px; + overflow: hidden; + height: 110px; + position: relative; + align-content: center; + padding-bottom: 9px; } .icon { @@ -28,6 +47,7 @@ -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; + padding-bottom: 9px; } .items { diff --git a/ui/webapp/src/layout/explore/grid/index.tsx b/ui/webapp/src/layout/explore/grid/index.tsx index 35c216be..0be30c0d 100644 --- a/ui/webapp/src/layout/explore/grid/index.tsx +++ b/ui/webapp/src/layout/explore/grid/index.tsx @@ -1,7 +1,7 @@ -import { cutString } from 'common'; import isUndefined from 'lodash/isUndefined'; import { createEffect, createSignal, For, on, Show } from 'solid-js'; +import detectIfSafari from '../../../utils/detectIfSafari'; import generateColorsArray from '../../../utils/generateColorsArray'; import getCategoriesWithItems from '../../../utils/getCategoriesWithItems'; import { SubcategoryDetails } from '../../../utils/gridCategoryLayout'; @@ -22,6 +22,7 @@ interface CatProps { categoryName: string; isOverriden: boolean; content: CategoryData; + isSafari: boolean; } const Category = (props: CatProps) => { @@ -29,6 +30,7 @@ const Category = (props: CatProps) => { createEffect( () => { + console.log('isSafari ---->>>> ', props.isSafari); if (!isUndefined(props.content)) { const subcategoriesTmp: SubcategoryDetails[] = []; Object.keys(props.content).forEach((subcat: string) => { @@ -51,14 +53,25 @@ const Category = (props: CatProps) => { 0}>
-
{cutString(props.categoryName, 30)}
+ +
{props.categoryName}
+
+ } + > +
+
{props.categoryName}
+
+
@@ -82,6 +95,7 @@ const GridCategory = (props: Props) => { const [isVisible, setIsVisible] = createSignal(false); const [catWithItems, setCatWithItems] = createSignal([]); const data = () => props.data; + const isSafari = () => detectIfSafari(); createEffect(() => { if (props.initialIsVisible !== isVisible()) { @@ -115,6 +129,7 @@ const GridCategory = (props: Props) => { bgColor={[...colorsList()][index()]} catSectionNumber={Object.keys(data()).length - 1} content={data()[cat]} + isSafari={isSafari()} /> ); }} diff --git a/ui/webapp/src/utils/detectIfSafari.ts b/ui/webapp/src/utils/detectIfSafari.ts new file mode 100644 index 00000000..598a7a76 --- /dev/null +++ b/ui/webapp/src/utils/detectIfSafari.ts @@ -0,0 +1,5 @@ +const detectIfSafari = (): boolean => { + return /^((?!chrome|android).)*safari/i.test(navigator.userAgent); +}; + +export default detectIfSafari;