From ba3005d47ce5f0852d051386e8beed7935162df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 14 May 2020 14:03:52 +0100 Subject: [PATCH] fix(ui): render last 4 filters on history for mobile --- .../Components/NavBar/FilterInput/History.js | 5 ++- .../NavBar/FilterInput/History.test.js | 32 ++++++++++++++++++- ui/src/Components/NavBar/index.stories.js | 15 ++++++++- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/ui/src/Components/NavBar/FilterInput/History.js b/ui/src/Components/NavBar/FilterInput/History.js index 77d18ed1f..829ac429b 100644 --- a/ui/src/Components/NavBar/FilterInput/History.js +++ b/ui/src/Components/NavBar/FilterInput/History.js @@ -17,6 +17,7 @@ import { faTrash } from "@fortawesome/free-solid-svg-icons/faTrash"; import { AlertStore } from "Stores/AlertStore"; import { Settings } from "Stores/Settings"; +import { IsMobile } from "Common/Device"; import { DropdownSlide } from "Components/Animations/DropdownSlide"; import { HistoryLabel } from "Components/Labels/HistoryLabel"; import { useOnClickOutside } from "Hooks/useOnClickOutside"; @@ -62,6 +63,8 @@ const HistoryMenu = ({ afterClick, onClear, }) => { + const maxItems = IsMobile() ? 4 : 8; + return (
Empty ) : ( - filters.map((historyFilters) => ( + filters.slice(0, maxItems).map((historyFilters) => (