Improved the look of the OutlinePanel
This commit is contained in:
parent
cf99805f89
commit
7b0d0dfa7f
3 changed files with 68 additions and 35 deletions
|
@ -3,6 +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 {lighten, transparentize} from 'polished'
|
||||||
|
|
||||||
export const Container = styled.li<{depth: number}>`
|
export const Container = styled.li<{depth: number}>`
|
||||||
--depth: ${(props) => props.depth};
|
--depth: ${(props) => props.depth};
|
||||||
|
@ -14,53 +15,100 @@ export const Container = styled.li<{depth: number}>`
|
||||||
export const BaseHeader = styled.div<{}>``
|
export const BaseHeader = styled.div<{}>``
|
||||||
|
|
||||||
const Header = styled(BaseHeader)`
|
const Header = styled(BaseHeader)`
|
||||||
padding-left: calc(16px + var(--depth) * 16px);
|
padding-left: calc(4px + var(--depth) * 16px);
|
||||||
height: 22px;
|
height: 22px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
|
--item-bg: #393d42b8;
|
||||||
|
--item-border-color: ${() => lighten(0.05, '#393d42b8')};
|
||||||
|
color: ${() => transparentize(0.25, 'white')};
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
--item-bg: ${() => lighten(0.1, '#393d42b8')};
|
||||||
|
--item-border-color: ${() => lighten(0.45, '#393d42b8')};
|
||||||
|
}
|
||||||
|
|
||||||
&.selected {
|
&.selected {
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
--item-bg: ${() => lighten(0.2, '#393d42b8')};
|
||||||
|
--item-border-color: ${() => lighten(0.45, '#393d42b8')};
|
||||||
}
|
}
|
||||||
|
|
||||||
&.descendant-is-selected {
|
&.descendant-is-selected {
|
||||||
|
color: ${() => transparentize(0.15, 'white')};
|
||||||
|
|
||||||
|
--item-bg: ${() => lighten(0.05, '#393d42b8')};
|
||||||
|
--item-border-color: ${() => lighten(0.1, '#393d42b8')};
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const outlineItemFont = css`
|
export const outlineItemFont = css`
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
& {
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const Head_Label = styled.span`
|
const Head_Label = styled.span`
|
||||||
${outlineItemFont};
|
${outlineItemFont};
|
||||||
color: #ffffffdb;
|
|
||||||
background-color: #758184;
|
|
||||||
padding: 2px 8px;
|
|
||||||
border-radius: 2px;
|
|
||||||
pointer-events: auto;
|
|
||||||
|
|
||||||
${Header}:hover > & {
|
padding: 2px 8px;
|
||||||
background-color: red;
|
pointer-events: auto;
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
height: 15px;
|
||||||
|
background-color: var(--item-bg);
|
||||||
|
border-radius: 2px;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
border: 1px solid var(--item-border-color);
|
||||||
|
position: absolute;
|
||||||
|
inset: 0px;
|
||||||
|
display: block;
|
||||||
|
content: ' ';
|
||||||
|
z-index: -1;
|
||||||
|
pointer-events: none;
|
||||||
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
${Header}.selected > & {
|
&:before {
|
||||||
color: white;
|
position: absolute;
|
||||||
background-color: #464242;
|
inset: -1px -20px;
|
||||||
|
display: block;
|
||||||
|
content: ' ';
|
||||||
|
z-index: 0;
|
||||||
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const Head_IconContainer = styled.span`
|
const Head_IconContainer = styled.span`
|
||||||
width: 12px;
|
width: 18px;
|
||||||
margin-right: 8px;
|
box-sizing: border-box;
|
||||||
|
height: 18px;
|
||||||
|
margin-right: 4px;
|
||||||
/* background-color: #435356d9; */
|
/* background-color: #435356d9; */
|
||||||
color: black;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
|
opacity: 0.9;
|
||||||
|
|
||||||
${Header}.selected > & {
|
&:after {
|
||||||
color: white;
|
display: block;
|
||||||
background-color: #464242;
|
content: ' ';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0px;
|
||||||
|
z-index: -1;
|
||||||
|
background-color: var(--item-bg);
|
||||||
|
opacity: 0.3;
|
||||||
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,9 @@ const Title = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
`
|
`
|
||||||
|
|
||||||
const Header = styled.div``
|
const Header = styled.div`
|
||||||
|
display: none;
|
||||||
|
`
|
||||||
|
|
||||||
const F2 = styled.div`
|
const F2 = styled.div`
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
|
@ -1,28 +1,11 @@
|
||||||
import type Project from '@theatre/core/projects/Project'
|
import type Project from '@theatre/core/projects/Project'
|
||||||
import React, {useCallback} from 'react'
|
import React, {useCallback} from 'react'
|
||||||
import styled from 'styled-components'
|
|
||||||
import BaseItem from '@theatre/studio/panels/OutlinePanel/BaseItem'
|
import BaseItem from '@theatre/studio/panels/OutlinePanel/BaseItem'
|
||||||
import SheetsList from '@theatre/studio/panels/OutlinePanel/SheetsList/SheetsList'
|
import SheetsList from '@theatre/studio/panels/OutlinePanel/SheetsList/SheetsList'
|
||||||
import getStudio from '@theatre/studio/getStudio'
|
import getStudio from '@theatre/studio/getStudio'
|
||||||
import {usePrism} from '@theatre/dataverse-react'
|
import {usePrism} from '@theatre/dataverse-react'
|
||||||
import {getOutlineSelection} from '@theatre/studio/selectors'
|
import {getOutlineSelection} from '@theatre/studio/selectors'
|
||||||
|
|
||||||
const Container = styled.li<{depth: number}>`
|
|
||||||
--depth: ${(props) => props.depth};
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
list-style: none;
|
|
||||||
`
|
|
||||||
|
|
||||||
const Head = styled.div<{depth: number}>`
|
|
||||||
padding-left: calc(16px + var(--depth) * 20px);
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
|
||||||
`
|
|
||||||
|
|
||||||
const ProjectListItem: React.FC<{
|
const ProjectListItem: React.FC<{
|
||||||
depth: number
|
depth: number
|
||||||
project: Project
|
project: Project
|
||||||
|
|
Loading…
Reference in a new issue