fix: Animation of InputSelect is janky (#4061)

This commit is contained in:
Tom Moor
2022-09-06 10:17:52 +02:00
committed by GitHub
parent 2d39a6f0ab
commit e4023d87e2
3 changed files with 14 additions and 3 deletions

View File

@@ -13,7 +13,13 @@ import styled, { css } from "styled-components";
import Button, { Inner } from "~/components/Button";
import Text from "~/components/Text";
import useMenuHeight from "~/hooks/useMenuHeight";
import { Position, Background, Backdrop, Placement } from "./ContextMenu";
import { fadeAndScaleIn } from "~/styles/animations";
import {
Position,
Background as ContextMenuBackground,
Backdrop,
Placement,
} from "./ContextMenu";
import { MenuAnchorCSS } from "./ContextMenu/MenuItem";
import { LabelText } from "./Input";
@@ -170,6 +176,7 @@ const InputSelect = (props: Props) => {
ref={contentRef}
topAnchor={topAnchor}
rightAnchor={rightAnchor}
hiddenScrollbars
style={
maxHeight && topAnchor
? {
@@ -216,6 +223,10 @@ const InputSelect = (props: Props) => {
);
};
const Background = styled(ContextMenuBackground)`
animation: ${fadeAndScaleIn} 200ms ease;
`;
const Placeholder = styled.span`
color: ${(props) => props.theme.placeholder};
`;

View File

@@ -92,7 +92,7 @@ const Wrapper = styled.div<{
return "none";
}};
transition: all 100ms ease-in-out;
transition: box-shadow 100ms ease-in-out;
${(props) =>
props.$hiddenScrollbars &&

View File

@@ -10,7 +10,7 @@ const useMenuHeight = (
const isMobile = useMobile();
const { height: windowHeight } = useWindowSize();
React.useLayoutEffect(() => {
React.useEffect(() => {
const padding = 8;
if (visible && !isMobile) {