From b921758677c8b55d2ac326aca78fcf78610e231f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ril?= Date: Tue, 23 Jun 2020 13:13:30 +0100 Subject: [PATCH] feat(console): improve responsiveness for QueryPicker component (#428) The QueryPicker width is now 600px and it will automatically fit the screen when its width is smaller. --- ui/src/components/PopperHover/index.tsx | 2 +- ui/src/components/PopperToggle/index.tsx | 2 +- ui/src/index.tsx | 11 +++++++---- ui/src/scenes/Editor/Loader/index.tsx | 10 ++-------- ui/src/scenes/Editor/QueryPicker/index.tsx | 12 ++++++------ ui/src/scenes/SideMenu/index.tsx | 11 +++-------- 6 files changed, 20 insertions(+), 28 deletions(-) diff --git a/ui/src/components/PopperHover/index.tsx b/ui/src/components/PopperHover/index.tsx index fad8e9be3..ca6c4bad8 100644 --- a/ui/src/components/PopperHover/index.tsx +++ b/ui/src/components/PopperHover/index.tsx @@ -96,7 +96,7 @@ export const PopperHover = ({ {ReactDOM.createPortal( - + + diff --git a/ui/src/scenes/Editor/Loader/index.tsx b/ui/src/scenes/Editor/Loader/index.tsx index e9365db9d..73b0f6772 100644 --- a/ui/src/scenes/Editor/Loader/index.tsx +++ b/ui/src/scenes/Editor/Loader/index.tsx @@ -2,18 +2,13 @@ import React, { useEffect, useRef, useState } from "react" import { CSSTransition } from "react-transition-group" import styled, { keyframes } from "styled-components" -import { createGlobalFadeTransition, TransitionDuration } from "components" +import { TransitionDuration } from "components" import { color } from "utils" type Props = Readonly<{ show: boolean }> -const GlobalTransitionStyles = createGlobalFadeTransition( - "editor-loader-fade", - TransitionDuration.SLOW, -) - const move = keyframes` 0% { background-position: left bottom; @@ -69,9 +64,8 @@ const Loader = ({ show }: Props) => { return ( <> - } -const Wrapper = styled.div<{ _width: number }>` +const Wrapper = styled.div` display: flex; - max-height: ${({ _width }) => _width}px; - width: ${({ _width }) => _width}px; + max-height: 600px; + width: 600px; + max-width: 100vw; padding: 0.6rem 0; flex-direction: column; background: ${color("draculaBackgroundDarker")}; @@ -45,7 +46,6 @@ const QueryPicker = ({ hidePicker, queries, ref }: Props) => { const enterPress = useKeyPress("Enter", { preventDefault: true }) const [cursor, setCursor] = useState(0) const [hovered, setHovered] = useState() - const { sm } = useScreenSize() useEffect(() => { if (queries.length && downPress) { @@ -75,7 +75,7 @@ const QueryPicker = ({ hidePicker, queries, ref }: Props) => { }, [hovered, queries]) return ( - + Navigate the list with keys, exit with  diff --git a/ui/src/scenes/SideMenu/index.tsx b/ui/src/scenes/SideMenu/index.tsx index c6e47a57b..aa17ce814 100644 --- a/ui/src/scenes/SideMenu/index.tsx +++ b/ui/src/scenes/SideMenu/index.tsx @@ -3,17 +3,12 @@ import { useDispatch, useSelector } from "react-redux" import { CSSTransition } from "react-transition-group" import styled from "styled-components" -import { createGlobalFadeTransition, TransitionDuration } from "components" +import { TransitionDuration } from "components" import { actions, selectors } from "store" import { color } from "utils" import Schema from "../Schema" -const GlobalTransitionStyles = createGlobalFadeTransition( - "side-menu-backdrop-fade", - TransitionDuration.REG, -) - const WIDTH = 280 const Backdrop = styled.div` @@ -68,15 +63,15 @@ const SideMenu = () => { return ( <> - {opened && } +