From ff0f8d557b07aaa846aebf8883edee461caef93a Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Thu, 22 Jul 2021 21:53:56 +0200 Subject: [PATCH] Implement ToolbarSwitchSelect --- .../src/components/Toolbar/Toolbar.tsx | 11 ++- .../Toolbar/TransformControlsModeSelect.tsx | 52 +++++++------ .../Toolbar/utils/CompactModeSelect.tsx | 2 + theatre/studio/src/index.ts | 2 + .../toolbar/ToolbarDropdownSelect.tsx | 15 ++++ .../toolbar/ToolbarIconButton.tsx | 9 ++- .../toolbar/ToolbarSwitchSelect.tsx | 77 +++++++++++++++++++ 7 files changed, 137 insertions(+), 31 deletions(-) create mode 100644 theatre/studio/src/uiComponents/toolbar/ToolbarDropdownSelect.tsx create mode 100644 theatre/studio/src/uiComponents/toolbar/ToolbarSwitchSelect.tsx diff --git a/packages/plugin-r3f/src/components/Toolbar/Toolbar.tsx b/packages/plugin-r3f/src/components/Toolbar/Toolbar.tsx index b1e2d9c..47a08d5 100644 --- a/packages/plugin-r3f/src/components/Toolbar/Toolbar.tsx +++ b/packages/plugin-r3f/src/components/Toolbar/Toolbar.tsx @@ -2,13 +2,16 @@ import type {VFC} from 'react' import React from 'react' import {useEditorStore} from '../../store' import shallow from 'zustand/shallow' -import {GiPocketBow, IoCameraOutline} from 'react-icons/all' +import {GiPocketBow, IoCameraOutline, RiFocus3Line} from 'react-icons/all' import {Vector3} from 'three' import type {$FixMe} from '@theatre/shared/utils/types' import studio, {ToolbarIconButton} from '@theatre/studio' import {getSelected} from '../useSelected' import {usePrism, useVal} from '@theatre/dataverse-react' import styled from 'styled-components' +import TransformControlsModeSelect from './TransformControlsModeSelect' +import ViewportShadingSelect from './ViewportShadingSelect' +import TransformControlsSpaceSelect from './TransformControlsSpaceSelect' const ToolGroup = styled.div` pointer-events: auto; @@ -44,7 +47,7 @@ const Toolbar: VFC = () => { label="Create snapshot" /> - {/* + @@ -75,7 +78,7 @@ const Toolbar: VFC = () => { /> - } onClick={() => { @@ -99,7 +102,7 @@ const Toolbar: VFC = () => { } }} /> - */} + void + onChange: (value: string) => void } const TransformControlsModeSelect: VFC = ({ value, onChange, -}) => ( - , - }, - { - option: 'rotate', - label: 'Tool: Rotate', - icon: , - }, - { - option: 'scale', - label: 'Tool: Scale', - icon: , - }, - ]} - /> -) +}) => { + return ( + , + }, + { + value: 'rotate', + label: 'Tool: Rotate', + icon: , + }, + { + value: 'scale', + label: 'Tool: Scale', + icon: , + }, + ]} + /> + ) +} export default TransformControlsModeSelect diff --git a/packages/plugin-r3f/src/components/Toolbar/utils/CompactModeSelect.tsx b/packages/plugin-r3f/src/components/Toolbar/utils/CompactModeSelect.tsx index f696f13..2635023 100644 --- a/packages/plugin-r3f/src/components/Toolbar/utils/CompactModeSelect.tsx +++ b/packages/plugin-r3f/src/components/Toolbar/utils/CompactModeSelect.tsx @@ -55,6 +55,8 @@ function OptionButton