refactor(Calendar): improve responsiveness

This commit is contained in:
Tim 2024-07-04 13:51:56 +02:00
parent a561ee0e3e
commit f6c4e66c77
5 changed files with 87 additions and 10 deletions

View file

@ -12,14 +12,26 @@
overflow-y: auto; overflow-y: auto;
} }
@media only screen and (max-width: @minimum) and (orientation: portrait) { @media only screen and (max-width: @small) and (orientation: portrait) {
.list { .list {
display: none; 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) { @media only screen and (max-width: @small) and (orientation: landscape) {
.list {
width: 17rem;
}
}
@media only screen and (max-width: @xsmall) and (orientation: landscape) {
.list { .list {
width: 15rem; width: 15rem;
} }
} }

View file

@ -1,10 +1,13 @@
// Copyright (C) 2017-2024 Smart code 203358507 // Copyright (C) 2017-2024 Smart code 203358507
@import (reference) '~stremio/common/screen-sizes.less';
.cell { .cell {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
gap: 2rem;
background-color: var(--overlay-color); background-color: var(--overlay-color);
border: 0.15rem solid transparent; border: 0.15rem solid transparent;
overflow: hidden; overflow: hidden;
@ -21,7 +24,7 @@
.heading { .heading {
flex: none; flex: none;
position: relative; position: relative;
padding: 1rem; padding: 1rem 1rem 0 1rem;
.day { .day {
position: relative; position: relative;
@ -37,14 +40,14 @@
} }
} }
.body { .items {
flex: 1 1 auto; flex: 1 1 auto;
position: relative; position: relative;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 1rem; gap: 1rem;
height: 0; height: 0;
padding: 1rem; padding: 0 1rem 1rem 1rem;
.item { .item {
flex: none; flex: none;
@ -103,7 +106,7 @@
} }
&.past { &.past {
.body { .items {
opacity: 0.5; opacity: 0.5;
} }
} }
@ -116,3 +119,34 @@
border-color: var(--overlay-color); 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;
}
}
}

View file

@ -38,7 +38,7 @@ const Cell = ({ selected, monthInfo, date, items, onClick }: Props) => {
{date.day} {date.day}
</div> </div>
</div> </div>
<HorizontalScroll className={styles['body']}> <HorizontalScroll className={styles['items']}>
{ {
items.map(({ id, name, poster, deepLinks }) => ( items.map(({ id, name, poster, deepLinks }) => (
<Button key={id} className={styles['item']} href={deepLinks.metaDetailsStreams}> <Button key={id} className={styles['item']} href={deepLinks.metaDetailsStreams}>

View file

@ -1,5 +1,7 @@
// Copyright (C) 2017-2024 Smart code 203358507 // Copyright (C) 2017-2024 Smart code 203358507
@import (reference) '~stremio/common/screen-sizes.less';
.table { .table {
flex: auto; flex: auto;
position: relative; position: relative;
@ -15,7 +17,7 @@
grid-template-columns: repeat(7, 1fr); grid-template-columns: repeat(7, 1fr);
align-items: center; align-items: center;
.item { .day {
position: relative; position: relative;
padding: 0.5rem; padding: 0.5rem;
font-size: 1rem; font-size: 1rem;
@ -24,6 +26,14 @@
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
.long {
display: block;
}
.short {
display: none;
}
} }
} }
@ -37,4 +47,20 @@
gap: 1px; gap: 1px;
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
}
@media only screen and (max-width: @xsmall) {
.table {
.week {
.day {
.long {
display: none;
}
.short {
display: block;
}
}
}
}
} }

View file

@ -26,8 +26,13 @@ const Table = ({ items, selected, monthInfo, onChange }: Props) => {
<div className={styles['week']}> <div className={styles['week']}>
{ {
WEEK_DAYS.map((day) => ( WEEK_DAYS.map((day) => (
<div className={styles['item']} key={day}> <div className={styles['day']} key={day}>
{t(day)} <span className={styles['long']}>
{t(day)}
</span>
<span className={styles['short']}>
{t(day).slice(0, 3)}
</span>
</div> </div>
)) ))
} }