Skip to content

Commit

Permalink
Addon-backgrounds: Fix grid offset always using default value
Browse files Browse the repository at this point in the history
- Fix falsy value check to allow zero values in offsetX and offsetY parameters
- Fix default value fallback conditional logic
  • Loading branch information
cone56 committed Nov 25, 2020
1 parent 6316d49 commit deb1a8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/backgrounds/src/decorators/withGrid.ts
Expand Up @@ -33,8 +33,8 @@ export const withGrid = (StoryFn: StoryFunction, context: StoryContext) => {
const isLayoutPadded = parameters.layout === undefined || parameters.layout === 'padded';
// 16px offset in the grid to account for padded layout
const defaultOffset = isLayoutPadded ? 16 : 0;
const offsetX = gridParameters.offsetX || isInDocs ? 20 : defaultOffset;
const offsetY = gridParameters.offsetY || isInDocs ? 20 : defaultOffset;
const offsetX = gridParameters.offsetX ?? (isInDocs ? 20 : defaultOffset);
const offsetY = gridParameters.offsetY ?? (isInDocs ? 20 : defaultOffset);

const gridStyles = useMemo(() => {
const selector =
Expand Down

0 comments on commit deb1a8c

Please sign in to comment.