Style tweaks to the OutlinePanel

This commit is contained in:
Aria Minaei 2021-08-21 20:01:42 +02:00
parent 3357ba5f5b
commit 158961c82a
3 changed files with 34 additions and 35 deletions

View file

@ -3,8 +3,7 @@ import React from 'react'
import {GoChevronRight, DiHtml53DEffects} from 'react-icons/all' import {GoChevronRight, DiHtml53DEffects} from 'react-icons/all'
import styled, {css} from 'styled-components' import styled, {css} from 'styled-components'
import noop from '@theatre/shared/utils/noop' import noop from '@theatre/shared/utils/noop'
import {transparentize, darken, opacify, lighten} from 'polished' import {darken, lighten} from 'polished'
import {rowBgColor} from '@theatre/studio/panels/DetailPanel/propEditors/utils/SingleRowPropEditor'
import {pointerEventsAutoInNormalMode} from '@theatre/studio/css' import {pointerEventsAutoInNormalMode} from '@theatre/studio/css'
export const Container = styled.li` export const Container = styled.li`
@ -19,48 +18,44 @@ export const Container = styled.li`
export const BaseHeader = styled.div`` export const BaseHeader = styled.div``
const baseBg = lighten(0.05, rowBgColor) const baseBg = `#3e4447`
const baseFontColor = transparentize(0.25, 'white') const baseBorderColor = `#34343e`
const baseBorderColor = transparentize(0.88, 'white')
export const outlinePanelTheme = {baseBg, baseFontColor, baseBorderColor}
const Header = styled(BaseHeader)` const Header = styled(BaseHeader)`
padding-left: calc(4px + var(--depth) * 16px); padding-left: calc(4px + var(--depth) * 16px);
padding-right: 8px; padding-right: 8px;
height: 24px; height: 28px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-wrap: nowrap;
align-items: center; align-items: center;
pointer-events: none; pointer-events: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
color: ${baseFontColor}; color: rgba(255, 255, 255, 0.75);
--item-bg: ${baseBg}; --item-bg: ${baseBg};
--item-border-color: ${baseBorderColor}; --item-border-color: ${baseBorderColor};
&:hover { &.descendant-is-selected {
color: ${opacify(1, baseFontColor)}; color: rgba(255, 255, 255, 0.9);
--item-bg: ${() => darken(0.07, baseBg)}; --item-bg: ${() => darken(0.1, baseBg)};
--item-border-color: ${opacify(0.1, baseBorderColor)}; --item-border-color: ${baseBorderColor};
}
&:hover {
color: #fff;
--item-bg: ${() => darken(0.12, baseBg)};
--item-border-color: ${lighten(0.1, baseBorderColor)};
} }
&.selected { &.selected {
color: ${opacify(1, baseFontColor)}; color: #fff;
--item-bg: ${() => darken(0.15, baseBg)}; --item-bg: ${() => darken(0.15, baseBg)};
--item-border-color: ${opacify(0.05, baseBorderColor)}; --item-border-color: ${lighten(0.05, baseBorderColor)};
}
&.descendant-is-selected {
color: ${opacify(0.1, baseFontColor)};
--item-bg: ${() => darken(0.05, baseBg)};
--item-border-color: ${baseBorderColor};
} }
` `
@ -77,10 +72,11 @@ const Head_Label = styled.span`
padding: 2px 8px; padding: 2px 8px;
${pointerEventsAutoInNormalMode}; ${pointerEventsAutoInNormalMode};
position: relative; position: relative;
display: block; display: flex;
height: 13px; height: 17px;
align-items: center;
background-color: var(--item-bg); background-color: var(--item-bg);
/* border-radius: 2px; */
&:after { &:after {
border: 1px solid var(--item-border-color); border: 1px solid var(--item-border-color);
@ -92,9 +88,10 @@ const Head_Label = styled.span`
pointer-events: none; pointer-events: none;
border-radius: 2px; border-radius: 2px;
box-sizing: border-box; box-sizing: border-box;
box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2); box-shadow: 0px 3px 4px -1px rgba(0, 0, 0, 0.48);
} }
// hit-zone
&:before { &:before {
position: absolute; position: absolute;
inset: -1px -20px; inset: -1px -20px;
@ -110,7 +107,6 @@ const Head_IconContainer = styled.span`
box-sizing: border-box; box-sizing: border-box;
height: 18px; height: 18px;
margin-right: 4px; margin-right: 4px;
/* background-color: #435356d9; */
font-weight: 500; font-weight: 500;
display: flex; display: flex;
align-items: center; align-items: center;
@ -125,13 +121,12 @@ const Head_IconContainer = styled.span`
inset: 0px; inset: 0px;
z-index: -1; z-index: -1;
background-color: var(--item-bg); background-color: var(--item-bg);
opacity: 0.75; opacity: 1;
border-radius: 2px; border-radius: 2px;
} }
` `
const Head_Icon_WithDescendants = styled.span<{isOpen: boolean}>` const Head_Icon_WithDescendants = styled.span<{isOpen: boolean}>`
width: 12px;
font-size: 9px; font-size: 9px;
position: relative; position: relative;
display: block; display: block;
@ -177,7 +172,9 @@ const BaseItem: React.FC<{
)} )}
</Head_IconContainer> </Head_IconContainer>
<Head_Label>{label}</Head_Label> <Head_Label>
<span>{label}</span>
</Head_Label>
{labelDecoration} {labelDecoration}
</Header> </Header>
{canContainChildren && <ChildrenContainer>{children}</ChildrenContainer>} {canContainChildren && <ChildrenContainer>{children}</ChildrenContainer>}

View file

@ -30,7 +30,7 @@ const Container = styled.div`
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 20px; width: 40px;
${pointerEventsAutoInNormalMode}; ${pointerEventsAutoInNormalMode};
} }
&:hover:before { &:hover:before {
@ -54,7 +54,7 @@ const Content = styled.div`
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
/* transform: translateX(-100%); */ transform: translateX(-100%);
pointer-events: none; pointer-events: none;
${Container}:hover & { ${Container}:hover & {

View file

@ -3,7 +3,9 @@ import BasicTooltip from './BasicTooltip'
const ErrorTooltip = styled(BasicTooltip)` const ErrorTooltip = styled(BasicTooltip)`
--popover-outer-stroke: #e11c1c; --popover-outer-stroke: #e11c1c;
--popover-bg: #391515; --popover-inner-stroke: #2c1c1c;
--popover-bg: #2c1c1c;
pointer-events: none !important;
` `
export default ErrorTooltip export default ErrorTooltip