From 085b7262e55dac6bdf8a88fd46407e0195e49b8f Mon Sep 17 00:00:00 2001 From: Matt Watson Date: Thu, 9 May 2024 20:37:21 -0400 Subject: [PATCH] try vertical tabs --- src/components/trays/layers/layer-card.js | 23 ++++----- src/components/trays/layers/layer-tabs.js | 59 +++++++++++++++++++++++ 2 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 src/components/trays/layers/layer-tabs.js diff --git a/src/components/trays/layers/layer-card.js b/src/components/trays/layers/layer-card.js index 0247da06..07c69f9f 100644 --- a/src/components/trays/layers/layer-card.js +++ b/src/components/trays/layers/layer-card.js @@ -4,7 +4,6 @@ import { Accordion, AccordionDetails, Avatar, - Box, ButtonGroup, Stack, Switch, @@ -18,7 +17,7 @@ import { } from '@mui/icons-material'; import { useLayers } from '@context'; import { useToggleState } from '@hooks'; -import { LayerActions } from './layer-card-actions'; +import { LayerTabs } from './layer-tabs'; import { ActionButton } from '@components/buttons'; export const LayerCard = ({ index, layer }) => { @@ -68,7 +67,7 @@ export const LayerCard = ({ index, layer }) => { - {layerTypes[layer.properties.product_type].name} + { layerTypes[layer.properties.product_type].name } { position: 'relative', // remove default margin that doesn't work well in our situation. marginInline: 0, + borderLeft: '6px solid', + // borderLeftColor: isVisible + // ? `rgba(${ theme.palette.primary.mainChannel }) / 1.0` + // : `rgba(${ theme.palette.primary.mainChannel }) / 0.2`, + borderLeftColor: isVisible + ? `primary.plainColor` + : `primary.plainDisabledColor`, '.MuiAccordionDetails-content': { paddingInline: 0, paddingBlock: 0, }, }}> - - - { JSON.stringify(layer.properties, null, 2) } - + diff --git a/src/components/trays/layers/layer-tabs.js b/src/components/trays/layers/layer-tabs.js new file mode 100644 index 00000000..fda5615d --- /dev/null +++ b/src/components/trays/layers/layer-tabs.js @@ -0,0 +1,59 @@ +import React, { useCallback } from 'react'; +import PropTypes from 'prop-types'; +import { Tab, TabList, TabPanel, Tabs } from '@mui/joy'; +import { + Palette as ColorIcon, + DataObject as DetailsIcon, + DeleteForever as RemoveIcon, +} from '@mui/icons-material'; + +export const LayerTabs = ({ layer = {} }) => { + const DetailsPanel = useCallback(() => ( + + { JSON.stringify(layer.properties, null, 2) } + + ), []); + + const ColorControlPanel = useCallback(() => ( + + ColorRamp & Opacity + + ), []); + + const RemoveLayerPanel = useCallback(() => ( + + REMOVE LAYER: Are you sure? +
+
+
+ [CONFIRM BUTTON] +
+ ), []); + + return ( + + + + + + + + + + + ); +}; + +LayerTabs.propTypes = { + layer: PropTypes.object.isRequired, +};