Use text color rather than bg to highlight hovered props

This commit is contained in:
Aria Minaei 2022-06-13 15:00:21 +02:00 committed by Aria
parent 1b41f1afca
commit dc7e5a1128
3 changed files with 18 additions and 11 deletions

View file

@ -33,7 +33,7 @@ const Header = deriver(styled.div<{isHighlighted: PropHighlighted}>`
align-items: stretch; align-items: stretch;
position: relative; position: relative;
background-color: ${getDetailRowHighlightBackground}; /* background-color: ${getDetailRowHighlightBackground}; */
`) `)
const Padding = styled.div` const Padding = styled.div`
@ -42,7 +42,7 @@ const Padding = styled.div`
align-items: center; align-items: center;
` `
const PropName = styled.div` const PropName = deriver(styled.div<{isHighlighted: PropHighlighted}>`
margin-left: 4px; margin-left: 4px;
cursor: default; cursor: default;
height: 100%; height: 100%;
@ -54,7 +54,7 @@ const PropName = styled.div`
} }
${() => propNameTextCSS}; ${() => propNameTextCSS};
` `)
const color = transparentize(0.05, `#282b2f`) const color = transparentize(0.05, `#282b2f`)
@ -114,8 +114,6 @@ function DetailCompoundPropEditor<
[pointerToProp], [pointerToProp],
) )
// previous versions of the DetailCompoundPropEditor had a context menu item for "Reset values".
return ( return (
<Container> <Container>
{contextMenu} {contextMenu}
@ -126,7 +124,12 @@ function DetailCompoundPropEditor<
> >
<Padding> <Padding>
{tools.controlIndicators} {tools.controlIndicators}
<PropName ref={propNameContainerRef}>{propName || 'Props'}</PropName> <PropName
isHighlighted={isPropHighlightedD}
ref={propNameContainerRef}
>
{propName || 'Props'}
</PropName>
</Padding> </Padding>
</Header> </Header>

View file

@ -33,7 +33,7 @@ const Container = deriver(styled.div<{
position: relative; position: relative;
${pointerEventsAutoInNormalMode}; ${pointerEventsAutoInNormalMode};
background-color: ${getDetailRowHighlightBackground}; /* background-color: ${getDetailRowHighlightBackground}; */
`) `)
const Left = styled.div` const Left = styled.div`
@ -50,7 +50,9 @@ const Left = styled.div`
width: calc(100% - var(--right-width)); width: calc(100% - var(--right-width));
` `
const PropNameContainer = styled.div` const PropNameContainer = deriver(styled.div<{
isHighlighted: PropHighlighted
}>`
text-align: left; text-align: left;
flex: 1 0; flex: 1 0;
white-space: nowrap; white-space: nowrap;
@ -65,7 +67,7 @@ const PropNameContainer = styled.div`
&:hover { &:hover {
color: white; color: white;
} }
` `)
const ControlsContainer = styled.div` const ControlsContainer = styled.div`
flex-basis: 8px; flex-basis: 8px;
@ -118,6 +120,7 @@ export function SingleRowPropEditor<T>({
<Left> <Left>
<ControlsContainer>{editingTools.controlIndicators}</ControlsContainer> <ControlsContainer>{editingTools.controlIndicators}</ControlsContainer>
<PropNameContainer <PropNameContainer
isHighlighted={isPropHighlightedD}
ref={propNameContainerRef} ref={propNameContainerRef}
title={['obj', 'props', ...getPointerParts(pointerToProp).path].join( title={['obj', 'props', ...getPointerParts(pointerToProp).path].join(
'.', '.',

View file

@ -1,8 +1,9 @@
import type {PropHighlighted} from '@theatre/studio/panels/SequenceEditorPanel/whatPropIsHighlighted'
import {css} from 'styled-components' import {css} from 'styled-components'
export const propNameTextCSS = css` export const propNameTextCSS = css<{isHighlighted?: PropHighlighted}>`
font-weight: 300; font-weight: 300;
font-size: 11px; font-size: 11px;
color: #919191; color: ${(props) => (props.isHighlighted === 'self' ? '#CCC' : '#919191')};
text-shadow: 0.5px 0.5px 2px rgba(0, 0, 0, 0.3); text-shadow: 0.5px 0.5px 2px rgba(0, 0, 0, 0.3);
` `