Experiment: Transparent outline pane

This commit is contained in:
Aria Minaei 2021-07-15 01:19:13 +02:00
parent acbba8ee48
commit ce3d5d3a50
4 changed files with 62 additions and 41 deletions

View file

@ -31,7 +31,7 @@ export const F1 = styled.div`
font-size: 11px;
border-bottom: 2px solid rgba(0, 0, 0, 0.45);
background: ${theme.panel.bg};
box-size: border-box;
box-sizing: border-box;
`
export const Punctuation = styled.span`

View file

@ -1,11 +1,8 @@
import {theme} from '@theatre/studio/css'
import type {VoidFn} from '@theatre/shared/utils/types'
import React from 'react'
import {HiOutlineChevronRight} from 'react-icons/all'
import styled from 'styled-components'
import {GoChevronRight, DiHtml53DEffects} from 'react-icons/all'
import styled, {css} from 'styled-components'
import noop from '@theatre/shared/utils/noop'
import {lighten} from 'polished'
import {propNameText} from '@theatre/studio/panels/ObjectEditorPanel/propEditors/utils/SingleRowPropEditor'
export const Container = styled.li<{depth: number}>`
--depth: ${(props) => props.depth};
@ -16,46 +13,62 @@ export const Container = styled.li<{depth: number}>`
export const BaseHeader = styled.div<{}>``
const Header = styled(BaseHeader)<{
selectionStatus: SelectionStatus
}>`
padding-left: calc(16px + var(--depth) * 20px);
height: 28px;
const Header = styled(BaseHeader)`
padding-left: calc(16px + var(--depth) * 16px);
height: 22px;
box-sizing: border-box;
display: flex;
align-items: center;
color: ${({selectionStatus}) =>
lighten(
selectionStatus === 'selected' ? 0.2 : 0,
theme.panel.body.compoudThing.label.color,
)};
pointer-events: none;
background: ${({selectionStatus}) =>
selectionStatus === 'selected'
? '#1919245e'
: selectionStatus === 'descendant-is-selected'
? '#19192426'
: 'transparent'};
&.selected {
}
box-sizing: border-box;
&:hover {
color: ${lighten(0.2, theme.panel.body.compoudThing.label.color)};
&.descendant-is-selected {
}
`
export const outlineItemFont = css`
font-weight: 500;
font-size: 11px;
`
const Head_Label = styled.span`
${propNameText}
${outlineItemFont};
color: #ffffffdb;
background-color: #758184;
padding: 2px 8px;
border-radius: 2px;
pointer-events: auto;
${Header}:hover > & {
background-color: red;
}
${Header}.selected > & {
color: white;
background-color: #464242;
}
`
const Head_IconContainer = styled.span`
width: 12px;
margin-right: 8px;
/* background-color: #435356d9; */
color: black;
font-weight: 500;
${Header}.selected > & {
color: white;
background-color: #464242;
}
`
const Head_Icon = styled.span<{isOpen: boolean}>`
const Head_Icon_WithDescendants = styled.span<{isOpen: boolean}>`
width: 12px;
font-size: 9px;
position: relative;
display: block;
transform: rotateZ(${(props) => (props.isOpen ? 90 : 0)}deg);
`
@ -81,13 +94,14 @@ const BaseItem: React.FC<{
return (
<Container depth={depth}>
<Header selectionStatus={selectionStatus} onClick={select ?? noop}>
<Header className={selectionStatus} onClick={select ?? noop}>
<Head_IconContainer>
{canContainChildren && (
<Head_Icon isOpen={true}>
{/* <GoChevronRight /> */}
<HiOutlineChevronRight />
</Head_Icon>
{canContainChildren ? (
<Head_Icon_WithDescendants isOpen={true}>
<GoChevronRight />
</Head_Icon_WithDescendants>
) : (
<DiHtml53DEffects />
)}
</Head_IconContainer>

View file

@ -4,10 +4,6 @@ import styled from 'styled-components'
import ProjectsList from './ProjectsList/ProjectsList'
import type {PanelPosition} from '@theatre/studio/store/types'
import BasePanel from '@theatre/studio/panels/BasePanel/BasePanel'
import {
F1,
F2,
} from '@theatre/studio/panels/ObjectEditorPanel/ObjectEditorPanel'
import PanelWrapper from '@theatre/studio/panels/BasePanel/PanelWrapper'
import PanelDragZone from '@theatre/studio/panels/BasePanel/PanelDragZone'
@ -38,20 +34,30 @@ const Container = styled(PanelWrapper)`
overflow-y: hidden;
display: flex;
flex-direction: column;
background-color: transparent;
box-shadow: none;
`
const Title = styled.div`
width: 100%;
`
const Header = styled.div``
const F2 = styled.div`
flex-grow: 1;
overflow-y: scroll;
padding: 0;
`
const Content: React.FC = () => {
return usePrism(() => {
return (
<Container>
<PanelDragZone>
<F1>
<Header>
<Title>Outline</Title>
</F1>
</Header>
</PanelDragZone>
<F2>
<ProjectsList />

View file

@ -13,6 +13,7 @@ const Container = styled.div`
display: flex;
gap: 1rem;
display: none;
`
const GlobalToolbar: React.FC<{}> = (props) => {