Skip to content

Commit

Permalink
fix(core): ⚡ core appbar fix for menu
Browse files Browse the repository at this point in the history
core appbar fix for menu

Ref #183
  • Loading branch information
techoneel committed Apr 4, 2024
1 parent afdc5a3 commit 36dbe4d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
7 changes: 6 additions & 1 deletion package/components/surfaces/CoreAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { NativeAppBar } from "@wrappid/native";

import DefaultAppBarContent from "./DefaultAppBarContent";
import { sanitizeComponentProps } from "../../utils/componentUtil";

export default function CoreAppBar(props) {
props = sanitizeComponentProps(CoreAppBar, props);
const { advanceMode = false, children, ...restProps } = props;
Expand Down Expand Up @@ -53,7 +54,7 @@ CoreAppBar.validProps = [
},
{
description: "If true, you can customize the appbar icon to Show and if false it will hide the icon.",
name : "iconEnabled",
name : "leftMenuEnabled",
types : [{ default: true, type: "boolean" }],
},
{
Expand Down Expand Up @@ -84,6 +85,10 @@ CoreAppBar.validProps = [
},
],
},
{
name : "handleDrawer",
types: [{ type: "function" }],
},
];

CoreAppBar.invalidProps = [];
Expand Down
25 changes: 10 additions & 15 deletions package/components/surfaces/DefaultAppBarContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { UtilityClasses, WrappidDataContext } from "@wrappid/styles";
import { useDispatch, useSelector } from "react-redux";

import CoreToolbar from "./CoreToolbar";
import { coreUseLocation } from "../../helper/routerHelper";
import { getSettingMeta } from "../../store/action/mdmAction";
import CoreClasses from "../../styles/CoreClasses";
import CoreAvatar from "../dataDisplay/CoreAvatar";
Expand All @@ -26,28 +25,25 @@ import QuickAddPopOver from "../utils/QuickAddPopOver";
export default function DefaultAppBarContent(props) {
const dispatch = useDispatch();
let { config } = React.useContext(WrappidDataContext);
// eslint-disable-next-line no-unused-vars
const location = coreUseLocation();
const auth = useSelector((state) => state.auth);
const mdm = useSelector((state) => state.mdm);
const [getSettingMetaFlag, setGetSettingMetaFlag] = useState(false);
// eslint-disable-next-line no-unused-vars
const [platform, setPlatform] = useState(null);
const [appbarType, setAppbarType] = useState("primary");

const {
handleDrawer,
logo,
logoEnabled: _logoEnabled = true,
iconEnabled: _iconEnabled = true,
leftMenuEnabled: _leftMenuEnabled = true,
} = props;
/**
* state driven component enablement of the app bar content
*/
// eslint-disable-next-line no-unused-vars
const [logoEnabled, setLogoEnabled] = useState(_logoEnabled);
// eslint-disable-next-line no-unused-vars
const [iconEnabled, setIconEnabled] = useState(_iconEnabled);
const [leftMenuEnabled, setLeftMenuEnabled] = useState(_leftMenuEnabled);

React.useEffect(() => {
/**
Expand Down Expand Up @@ -108,20 +104,12 @@ export default function DefaultAppBarContent(props) {
<CoreToolbar
styleClasses={[UtilityClasses.ALIGNMENT.JUSTIFY_CONTENT_SPACE_BETWEEN, CoreClasses.FLEX.DIRECTION_ROW, CoreClasses.ALIGNMENT.ALIGN_ITEMS_CENTER]}
>
{logoEnabled && (
<CoreImage
height={40}
width={120}
src={logo}
alt="WRAPPID" />
)
}

<CoreStack
direction="row"
styleClasses={[CoreClasses.ALIGNMENT.ALIGN_ITEMS_CENTER]}
>
{iconEnabled && (
{leftMenuEnabled && (
<CoreIconButton
styleClasses={appBarTextStyle}
aria-label="open drawer"
Expand All @@ -134,6 +122,13 @@ export default function DefaultAppBarContent(props) {
</CoreIconButton>
)}

{logoEnabled && (
<CoreImage
height={40}
width={120}
src={logo}
alt="WRAPPID" />
)}
</CoreStack>

{/* authenticated user content */}
Expand Down

0 comments on commit 36dbe4d

Please sign in to comment.