Skip to content

Commit

Permalink
refactor: apply blur from overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
abelflopes committed Jul 21, 2024
1 parent 3d33fd4 commit d5142dc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
}

.overlay {
backdrop-filter: blur(5px);
z-index: map-get-strict(elevation.$elevation, "overlay");
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease-in-out;
z-index: map-get-strict(elevation.$elevation, "overlay");

&__active {
opacity: 1;
Expand Down
8 changes: 7 additions & 1 deletion packages/components/overlay/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import classNames from "classnames";
export interface OverlayProps extends React.HTMLAttributes<HTMLDivElement> {
/** Specifies the visual style of the overlay */
skin?: "light" | "dark";
/** If set to true, will blur background */
blur?: boolean;
}

/**
Expand All @@ -16,8 +18,12 @@ export interface OverlayProps extends React.HTMLAttributes<HTMLDivElement> {

export const Overlay = ({
skin = "dark",
blur = true,
className,
...otherProps
}: Readonly<OverlayProps>): React.ReactElement => (
<div className={classNames(styles.root, styles[skin], className)} {...otherProps} />
<div
className={classNames(styles.root, styles[skin], blur && styles.blur, className)}
{...otherProps}
/>
);
4 changes: 4 additions & 0 deletions packages/components/overlay/src/styles/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
background-color: get-css-var(overlay, color);
}

.blur {
backdrop-filter: blur(5px);
}

@each $variation in (dark, light) {
.#{$variation} {
@include define-css-var(overlay, color, get-color("overlay-#{$variation}"));
Expand Down

0 comments on commit d5142dc

Please sign in to comment.