From 1c3a8ecb4d27b64035e1bf34a6a7335bf9aed9f9 Mon Sep 17 00:00:00 2001 From: manojava-gk Date: Fri, 19 Jan 2024 13:26:52 +0530 Subject: [PATCH 1/3] fix(usermenu): extend props. enable position and shodow properties --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/components/content/UserMenu/index.tsx | 16 +++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 081d67a0..afa02240 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.1.18 + +- fix(usermenu): extend props - position and shadow + ## 2.1.17 - fix(eslint): enable no-unsafe-return rule diff --git a/package.json b/package.json index b15229d1..fde20973 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@catena-x/portal-shared-components", - "version": "2.1.17", + "version": "2.1.18", "description": "Catena-X Portal Shared Components", "author": "Catena-X Contributors", "license": "Apache-2.0", diff --git a/src/components/content/UserMenu/index.tsx b/src/components/content/UserMenu/index.tsx index bd06d116..52aec393 100644 --- a/src/components/content/UserMenu/index.tsx +++ b/src/components/content/UserMenu/index.tsx @@ -26,7 +26,10 @@ interface UserMenuProps { userName: string userRole: string top?: number + width?: number + position?: string children?: React.ReactElement[] + shadow?: boolean onClickAway?: (event: MouseEvent | TouchEvent) => void } @@ -36,6 +39,9 @@ export const UserMenu = ({ userRole, children, top = 0, + width = 256, + position = 'absolute', + shadow = true, onClickAway = () => { // empty }, @@ -49,11 +55,11 @@ export const UserMenu = ({ display={open ? 'block' : 'none'} sx={{ borderRadius: 4, - backgroundColor: 'background.background01', - boxShadow: shadows['20'], - width: 256, + backgroundColor: shadow ? 'background.background01' : '#fff', + boxShadow: shadow ? shadows['20'] : 'none', + width: width, overflow: 'hidden', - position: 'absolute', + position: position, right: 0, top, }} @@ -61,7 +67,7 @@ export const UserMenu = ({ > Date: Tue, 23 Jan 2024 10:46:37 +0530 Subject: [PATCH 2/3] fix(usermenu): use sx props instead of individual style attributes --- src/components/content/UserMenu/index.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/content/UserMenu/index.tsx b/src/components/content/UserMenu/index.tsx index 52aec393..41ddff20 100644 --- a/src/components/content/UserMenu/index.tsx +++ b/src/components/content/UserMenu/index.tsx @@ -20,17 +20,17 @@ import { Box, ClickAwayListener, useTheme } from '@mui/material' import { Typography } from '../../basic/Typography' +import { type Theme } from '@mui/material/styles' +import { type SxProps } from '@mui/system' interface UserMenuProps { open: boolean userName: string userRole: string - top?: number - width?: number - position?: string children?: React.ReactElement[] shadow?: boolean onClickAway?: (event: MouseEvent | TouchEvent) => void + sx?: SxProps } export const UserMenu = ({ @@ -38,9 +38,11 @@ export const UserMenu = ({ userName, userRole, children, - top = 0, - width = 256, - position = 'absolute', + sx = { + top: '0px', + width: '256px', + position: 'absolute', + }, shadow = true, onClickAway = () => { // empty @@ -57,11 +59,9 @@ export const UserMenu = ({ borderRadius: 4, backgroundColor: shadow ? 'background.background01' : '#fff', boxShadow: shadow ? shadows['20'] : 'none', - width: width, overflow: 'hidden', - position: position, right: 0, - top, + ...sx, }} {...props} > From 52ee0e5404b9860ed2aa2aa5b8324df4f89e0c7c Mon Sep 17 00:00:00 2001 From: manojava-gk Date: Tue, 23 Jan 2024 10:49:12 +0530 Subject: [PATCH 3/3] chore(dependency): update dependency file --- DEPENDENCIES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index f6aa3ca3..9003a652 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -214,7 +214,7 @@ npm/npmjs/-/domhandler/4.3.1, BSD-2-Clause, approved, clearlydefined npm/npmjs/-/domutils/2.8.0, BSD-2-Clause, approved, clearlydefined npm/npmjs/-/dot-case/3.0.4, MIT, approved, clearlydefined npm/npmjs/-/dotenv-expand/10.0.0, BSD-2-Clause, approved, clearlydefined -npm/npmjs/-/dotenv/16.3.1, BSD-2-Clause, approved, clearlydefined +npm/npmjs/-/dotenv/16.3.1, BSD-2-Clause, approved, #12851 npm/npmjs/-/duplexify/3.7.1, MIT, approved, clearlydefined npm/npmjs/-/eastasianwidth/0.2.0, MIT, approved, clearlydefined npm/npmjs/-/ee-first/1.1.1, MIT, approved, clearlydefined