Skip to content

Commit

Permalink
Add backdrop container props (#540)
Browse files Browse the repository at this point in the history
* Allow backdrop container to get zIndez by props

* v4.7.8
  • Loading branch information
kapantzak authored Nov 6, 2024
1 parent 6ef88d9 commit e057284
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netdata/netdata-ui",
"version": "4.7.7",
"version": "4.7.8",
"description": "netdata UI kit",
"main": "dist/index.js",
"module": "dist/es6/index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/components/confirmation-dialog/confirmation-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ const ConfirmationDialog = ({
isConfirmPositive,
message,
title,
backdropContainerProps,
}) => {
return (
<Dialog onEsc={handleDecline}>
<Dialog onEsc={handleDecline} backdropContainerProps={backdropContainerProps}>
<Content data-testid={dataTestId}>
<Header data-testid={`${dataTestId}-headerContainer`}>
<Flex data-testid={`${dataTestId}-header`} gap={2}>
Expand Down
5 changes: 3 additions & 2 deletions src/components/confirmation-dialog/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export const Body = styled(ModalBody).attrs({
}
`

export const Dialog = styled(Modal).attrs({
export const Dialog = styled(Modal).attrs(props => ({
backdropProps: { backdropBlur: 8 },
})`
...props,
}))`
box-shadow:
0 11px 15px -7px rgb(0 0 0 / 20%),
0px 24px 38px 3px rgb(0 0 0 / 14%),
Expand Down
6 changes: 3 additions & 3 deletions src/components/templates/layer/backdropContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import backdropBlur from "@/components/templates/layer/mixins/backdropBlur"
const Container = styled.div`
position: fixed;
inset: 0;
z-index: 35;
z-index: ${({ zIndex }) => zIndex || "35"};
pointer-events: none;
outline: none;
`
Expand All @@ -19,8 +19,8 @@ const Backdrop = styled.div`
}
`

const BackdropContainer = ({ children, backdropProps, onClick }) => (
<Container data-testid="layer-backdropContainer">
const BackdropContainer = ({ children, backdropContainerProps, backdropProps, onClick }) => (
<Container data-testid="layer-backdropContainer" {...backdropContainerProps}>
<Backdrop data-testid="layer-backdrop" {...backdropProps} onClick={onClick} />
{children}
</Container>
Expand Down
8 changes: 7 additions & 1 deletion src/components/templates/layer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const Layer = ({
onEsc,
borderShadow,
children,
backdropContainerProps,
backdropProps,
...rest
}) => {
Expand Down Expand Up @@ -44,7 +45,12 @@ const Layer = ({

return ReactDOM.createPortal(
backdrop ? (
<BackdropContainer backdropProps={backdropProps} {...rest} onClick={onClickOutside}>
<BackdropContainer
backdropContainerProps={backdropContainerProps}
backdropProps={backdropProps}
{...rest}
onClick={onClickOutside}
>
{content}
</BackdropContainer>
) : (
Expand Down

0 comments on commit e057284

Please sign in to comment.