From f6c4e66c7719136471dcd7dc65509927abe1ef8d Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 4 Jul 2024 13:51:56 +0200 Subject: [PATCH] refactor(Calendar): improve responsiveness --- src/routes/Calendar/List/List.less | 16 +++++++-- src/routes/Calendar/Table/Cell/Cell.less | 42 +++++++++++++++++++++--- src/routes/Calendar/Table/Cell/Cell.tsx | 2 +- src/routes/Calendar/Table/Table.less | 28 +++++++++++++++- src/routes/Calendar/Table/Table.tsx | 9 +++-- 5 files changed, 87 insertions(+), 10 deletions(-) diff --git a/src/routes/Calendar/List/List.less b/src/routes/Calendar/List/List.less index dd0b63991..7daae20a1 100644 --- a/src/routes/Calendar/List/List.less +++ b/src/routes/Calendar/List/List.less @@ -12,14 +12,26 @@ overflow-y: auto; } -@media only screen and (max-width: @minimum) and (orientation: portrait) { +@media only screen and (max-width: @small) and (orientation: portrait) { .list { display: none; } } +@media only screen and (max-width: @medium) and (orientation: landscape) { + .list { + width: 20rem; + } +} + @media only screen and (max-width: @small) and (orientation: landscape) { + .list { + width: 17rem; + } +} + +@media only screen and (max-width: @xsmall) and (orientation: landscape) { .list { width: 15rem; } -} \ No newline at end of file +} diff --git a/src/routes/Calendar/Table/Cell/Cell.less b/src/routes/Calendar/Table/Cell/Cell.less index c47fc4901..ae9bf586d 100644 --- a/src/routes/Calendar/Table/Cell/Cell.less +++ b/src/routes/Calendar/Table/Cell/Cell.less @@ -1,10 +1,13 @@ // Copyright (C) 2017-2024 Smart code 203358507 +@import (reference) '~stremio/common/screen-sizes.less'; + .cell { position: relative; display: flex; flex-direction: column; justify-content: space-between; + gap: 2rem; background-color: var(--overlay-color); border: 0.15rem solid transparent; overflow: hidden; @@ -21,7 +24,7 @@ .heading { flex: none; position: relative; - padding: 1rem; + padding: 1rem 1rem 0 1rem; .day { position: relative; @@ -37,14 +40,14 @@ } } - .body { + .items { flex: 1 1 auto; position: relative; display: flex; flex-direction: row; gap: 1rem; height: 0; - padding: 1rem; + padding: 0 1rem 1rem 1rem; .item { flex: none; @@ -103,7 +106,7 @@ } &.past { - .body { + .items { opacity: 0.5; } } @@ -116,3 +119,34 @@ border-color: var(--overlay-color); } } + +@media only screen and (max-height: @small) { + .cell { + gap: 1rem; + } +} + +@media only screen and (max-width: @minimum) and (orientation: portrait) { + .cell { + .items { + .item { + border-radius: 0.25rem; + } + } + } +} + +@media only screen and (max-width: @xsmall) and (orientation: landscape) { + .cell { + flex-direction: row; + align-items: center; + + .heading { + padding: 0; + } + + .items { + display: none; + } + } +} \ No newline at end of file diff --git a/src/routes/Calendar/Table/Cell/Cell.tsx b/src/routes/Calendar/Table/Cell/Cell.tsx index 76442a640..b20ea9060 100644 --- a/src/routes/Calendar/Table/Cell/Cell.tsx +++ b/src/routes/Calendar/Table/Cell/Cell.tsx @@ -38,7 +38,7 @@ const Cell = ({ selected, monthInfo, date, items, onClick }: Props) => { {date.day} - + { items.map(({ id, name, poster, deepLinks }) => (