From 78d02c00b613f8fc10aafee176b5ffb98814aa57 Mon Sep 17 00:00:00 2001 From: Daniel Shleifman Date: Mon, 31 May 2021 18:42:37 +0300 Subject: [PATCH] adaptive design in cache view --- .../StatisticsField.jsx | 14 +++--- .../DialogTorrentDetailsContent/index.jsx | 2 +- .../DialogTorrentDetailsContent/style.js | 46 +++++++++++++++++-- 3 files changed, 49 insertions(+), 13 deletions(-) diff --git a/web/src/components/DialogTorrentDetailsContent/StatisticsField.jsx b/web/src/components/DialogTorrentDetailsContent/StatisticsField.jsx index 7ddf8fa..c6b0e65 100644 --- a/web/src/components/DialogTorrentDetailsContent/StatisticsField.jsx +++ b/web/src/components/DialogTorrentDetailsContent/StatisticsField.jsx @@ -1,14 +1,14 @@ -import { StatisticsFieldWrapper, StatisticsFieldIcon, StatisticsFieldValue, StatisticsFieldTitle } from './style' +import { WidgetFieldWrapper, WidgetFieldIcon, WidgetFieldValue, WidgetFieldTitle } from './style' export default function StatisticsField({ icon: Icon, title, value, iconBg, valueBg }) { return ( - - {title} - + + {title} + - + - {value} - + {value} + ) } diff --git a/web/src/components/DialogTorrentDetailsContent/index.jsx b/web/src/components/DialogTorrentDetailsContent/index.jsx index 8537acc..1310578 100644 --- a/web/src/components/DialogTorrentDetailsContent/index.jsx +++ b/web/src/components/DialogTorrentDetailsContent/index.jsx @@ -127,7 +127,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { Data - + diff --git a/web/src/components/DialogTorrentDetailsContent/style.js b/web/src/components/DialogTorrentDetailsContent/style.js index 67a5591..31b0374 100644 --- a/web/src/components/DialogTorrentDetailsContent/style.js +++ b/web/src/components/DialogTorrentDetailsContent/style.js @@ -98,9 +98,22 @@ export const WidgetWrapper = styled.div` display: grid; grid-template-columns: repeat(auto-fit, minmax(max-content, 220px)); gap: 20px; + + ${({ detailedView }) => + detailedView && + css` + @media (max-width: 800px) { + gap: 15px; + grid-template-columns: repeat(2, 1fr); + } + @media (max-width: 410px) { + gap: 10px; + grid-template-columns: 1fr; + } + `} ` -export const StatisticsFieldWrapper = styled.div` +export const WidgetFieldWrapper = styled.div` display: grid; grid-template-columns: 40px 1fr; grid-template-rows: min-content 50px; @@ -112,8 +125,13 @@ export const StatisticsFieldWrapper = styled.div` display: grid; place-items: center; } + + @media (max-width: 800px) { + grid-template-columns: 30px 1fr; + grid-template-rows: min-content 40px; + } ` -export const StatisticsFieldTitle = styled.div` +export const WidgetFieldTitle = styled.div` grid-area: title; justify-self: start; text-transform: uppercase; @@ -122,23 +140,33 @@ export const StatisticsFieldTitle = styled.div` font-weight: 500; ` -export const StatisticsFieldIcon = styled.div` +export const WidgetFieldIcon = styled.div` ${({ bgColor }) => css` grid-area: icon; color: rgba(255, 255, 255, 0.8); background: ${bgColor}; border-radius: 5px 0 0 5px; + + @media (max-width: 800px) { + > svg { + width: 50%; + } + } `} ` -export const StatisticsFieldValue = styled.div` +export const WidgetFieldValue = styled.div` ${({ bgColor }) => css` grid-area: value; - min-width: 170px; padding: 0 20px; color: #fff; font-size: 25px; background: ${bgColor}; border-radius: 0 5px 5px 0; + + @media (max-width: 800px) { + font-size: 18px; + padding: 0 4px; + } `} ` @@ -241,9 +269,17 @@ export const Table = styled.table` export const DetailedViewWidgetSection = styled.section` padding: 40px; background: linear-gradient(145deg, #e4f6ed, #b5dec9); + + @media (max-width: 800px) { + padding: 20px; + } ` export const DetailedViewCacheSection = styled.section` padding: 40px; box-shadow: inset 3px 25px 8px -25px rgba(0, 0, 0, 0.5); + + @media (max-width: 800px) { + padding: 20px; + } `