From ce3d5d3a5017f7b598fcbec439fd31f3872df619 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Thu, 15 Jul 2021 01:19:13 +0200 Subject: [PATCH] Experiment: Transparent outline pane --- .../ObjectEditorPanel/ObjectEditorPanel.tsx | 2 +- .../src/panels/OutlinePanel/BaseItem.tsx | 82 +++++++++++-------- .../src/panels/OutlinePanel/OutlinePanel.tsx | 18 ++-- .../toolbars/GlobalToolbar/GlobalToolbar.tsx | 1 + 4 files changed, 62 insertions(+), 41 deletions(-) diff --git a/theatre/studio/src/panels/ObjectEditorPanel/ObjectEditorPanel.tsx b/theatre/studio/src/panels/ObjectEditorPanel/ObjectEditorPanel.tsx index 77fa82a..b988e6d 100644 --- a/theatre/studio/src/panels/ObjectEditorPanel/ObjectEditorPanel.tsx +++ b/theatre/studio/src/panels/ObjectEditorPanel/ObjectEditorPanel.tsx @@ -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` diff --git a/theatre/studio/src/panels/OutlinePanel/BaseItem.tsx b/theatre/studio/src/panels/OutlinePanel/BaseItem.tsx index a189bac..b9881a1 100644 --- a/theatre/studio/src/panels/OutlinePanel/BaseItem.tsx +++ b/theatre/studio/src/panels/OutlinePanel/BaseItem.tsx @@ -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 ( -
+
- {canContainChildren && ( - - {/* */} - - + {canContainChildren ? ( + + + + ) : ( + )} diff --git a/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx b/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx index 31b3d1c..7bd324e 100644 --- a/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx +++ b/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx @@ -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 ( - +
Outline - +
diff --git a/theatre/studio/src/toolbars/GlobalToolbar/GlobalToolbar.tsx b/theatre/studio/src/toolbars/GlobalToolbar/GlobalToolbar.tsx index d5935bc..2b13580 100644 --- a/theatre/studio/src/toolbars/GlobalToolbar/GlobalToolbar.tsx +++ b/theatre/studio/src/toolbars/GlobalToolbar/GlobalToolbar.tsx @@ -13,6 +13,7 @@ const Container = styled.div` display: flex; gap: 1rem; + display: none; ` const GlobalToolbar: React.FC<{}> = (props) => {