@yogiswara/honcho-editor-ui 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,18 @@
1
1
  import React from "react";
2
+ type SubTab = {
3
+ value: string;
4
+ label: string;
5
+ inactiveIcon?: string;
6
+ activeIcon?: string;
7
+ };
2
8
  interface Props {
3
9
  activePanelMobile: string;
4
10
  activeSubPanel: string;
5
11
  setActivePanelMobile: (tab: string) => void;
6
- subNavigation: React.ReactNode;
12
+ setActiveSubPanel: (subTab: string) => void;
13
+ subTabs: {
14
+ [key: string]: SubTab[];
15
+ };
7
16
  panelContent: React.ReactNode;
8
17
  panelRef: React.RefObject<HTMLDivElement>;
9
18
  contentRef: React.RefObject<HTMLDivElement | null>;
@@ -1,11 +1,26 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Paper, Stack } from "@mui/material";
3
- // The hardcoded `subTabs` and `renderPanelContent` are now removed.
2
+ import { Box, Paper, Stack, BottomNavigation, BottomNavigationAction, CardMedia } from "@mui/material";
4
3
  export default function HImageEditorMobile(props) {
5
- // The handleChange function now only needs the renamed prop
6
4
  const handleChange = (event, newValue) => {
7
5
  props.setActivePanelMobile(newValue);
8
6
  };
7
+ // This function is now back inside the component
8
+ const renderSubNavigation = () => {
9
+ const currentSubTabs = props.subTabs[props.activePanelMobile];
10
+ if (!currentSubTabs)
11
+ return null;
12
+ return (_jsx(Paper, { sx: { backgroundColor: 'black', borderRadius: "0px", px: "44px" }, elevation: 3, children: _jsx(BottomNavigation, { showLabels: true, sx: { backgroundColor: 'black', gap: '10px' }, children: currentSubTabs.map((tab) => {
13
+ const isActive = props.activeSubPanel === tab.value;
14
+ const iconSrc = isActive ? tab.activeIcon : tab.inactiveIcon;
15
+ return (_jsx(BottomNavigationAction, { label: tab.label, value: tab.value, onClick: () => props.setActiveSubPanel(isActive ? '' : tab.value), icon: iconSrc && _jsx(CardMedia, { component: "img", image: iconSrc, sx: { width: "20px", height: "20px", mb: "5px" } }), sx: {
16
+ color: isActive ? 'white' : 'grey',
17
+ minWidth: 'auto', p: 0,
18
+ '& .MuiBottomNavigationAction-label': {
19
+ color: isActive ? 'white' : 'grey',
20
+ }
21
+ } }, tab.value));
22
+ }) }) }));
23
+ };
9
24
  return (_jsx(Paper, { elevation: 0, sx: {
10
25
  id: 'HImageEditorMobile',
11
26
  position: 'fixed',
@@ -38,5 +53,5 @@ export default function HImageEditorMobile(props) {
38
53
  overflowY: 'auto',
39
54
  scrollbarWidth: 'none',
40
55
  '&::-webkit-scrollbar': { display: 'none' },
41
- }, children: props.panelContent })] })), props.subNavigation] }) }));
56
+ }, children: props.panelContent })] })), renderSubNavigation()] }) }));
42
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "A complete UI component library for the Honcho photo editor.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",