From b076b2ae4881bebf1d2debd5333a83f220c26ca7 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Fri, 3 Jan 2025 15:39:48 +0100 Subject: [PATCH] Also accept false as value for sxx --- .changeset/heavy-squids-build.md | 5 +++++ packages/next-ui/utils/sxx.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/heavy-squids-build.md diff --git a/.changeset/heavy-squids-build.md b/.changeset/heavy-squids-build.md new file mode 100644 index 0000000000..597a4dd7b7 --- /dev/null +++ b/.changeset/heavy-squids-build.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/next-ui': patch +--- + +Also accept false as value for sxx diff --git a/packages/next-ui/utils/sxx.ts b/packages/next-ui/utils/sxx.ts index 280a2ceff1..5d272474f2 100644 --- a/packages/next-ui/utils/sxx.ts +++ b/packages/next-ui/utils/sxx.ts @@ -9,8 +9,8 @@ import type { SxProps, Theme } from '@mui/material' * sxx({ position: 'absolute', right: 0, top: 0 }, props.sx) * ``` */ -export const sxx = (...sxPropsArray: (SxProps | undefined)[]): SxProps => +export const sxx = (...sxPropsArray: (SxProps | undefined | false)[]): SxProps => sxPropsArray - .filter((v) => v !== undefined) + .filter((v) => !!v) .map((sx) => (Array.isArray(sx) ? sx : [sx])) .flat(1)