From 163758c2d24c1ea112027e0bfff3d70b9a8df4f4 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Fri, 20 Aug 2021 11:27:14 +0200 Subject: [PATCH] Nicer look for the arrow on top of popover --- .../src/uiComponents/Popover/BasicPopover.tsx | 8 +++- .../src/uiComponents/Popover/PopoverArrow.tsx | 48 +++++++++++++++---- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/theatre/studio/src/uiComponents/Popover/BasicPopover.tsx b/theatre/studio/src/uiComponents/Popover/BasicPopover.tsx index 262e3a1..57b369d 100644 --- a/theatre/studio/src/uiComponents/Popover/BasicPopover.tsx +++ b/theatre/studio/src/uiComponents/Popover/BasicPopover.tsx @@ -3,14 +3,18 @@ import {pointerEventsAutoInNormalMode} from '@theatre/studio/css' import {transparentize} from 'polished' import React from 'react' import styled from 'styled-components' -import PopoverArrow, {popoverArrowColor} from './PopoverArrow' +import PopoverArrow, {popoverArrowColors} from './PopoverArrow' export const popoverBackgroundColor = transparentize(0.05, `#2a2a31`) const Container = styled.div` position: absolute; background: ${popoverBackgroundColor}; - ${popoverArrowColor(popoverBackgroundColor)}; + ${popoverArrowColors({ + fill: popoverBackgroundColor, + innerStroke: `#505159`, + outerStroke: `black`, + })}; color: white; padding: 0; margin: 0; diff --git a/theatre/studio/src/uiComponents/Popover/PopoverArrow.tsx b/theatre/studio/src/uiComponents/Popover/PopoverArrow.tsx index 5ab6fef..61359f6 100644 --- a/theatre/studio/src/uiComponents/Popover/PopoverArrow.tsx +++ b/theatre/studio/src/uiComponents/Popover/PopoverArrow.tsx @@ -1,14 +1,22 @@ import React, {forwardRef, useContext} from 'react' -import {GoTriangleUp} from 'react-icons/all' import styled, {css} from 'styled-components' import ArrowContext from './ArrowContext' -export const popoverArrowColor = (color: string) => css` - --popover-arrow-color: ${color}; +export const popoverArrowColors = ({ + fill, + innerStroke, + outerStroke, +}: { + fill: string + innerStroke: string + outerStroke: string +}) => css` + --popover-arrow-fill: ${fill}; + --popover-arrow-inner-stroke: ${innerStroke}; + --popover-arrow-outer-stroke: ${outerStroke}; ` const Container = styled.div` - font-size: 18px; position: absolute; width: 0; height: 0; @@ -16,11 +24,11 @@ const Container = styled.div` ` const Adjust = styled.div` - width: 20px; - height: 18px; + width: 12px; + height: 8px; position: absolute; - left: -10px; - top: -11px; + left: -7px; + top: -8px; text-align: center; ` @@ -29,12 +37,34 @@ type Props = { color?: string } +const InnerTriangle = styled.path` + fill: var(--popover-arrow-fill); +` + +const InnerStroke = styled.path` + fill: var(--popover-arrow-inner-stroke); +` + +const OuterStroke = styled.path` + fill: var(--popover-arrow-outer-stroke); +` + const PopoverArrow = forwardRef(({className}, ref) => { const arrowStyle = useContext(ArrowContext) return ( - + + + + + )