Skip to content

Commit

Permalink
remove props in inline style plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bkrmendy committed Oct 10, 2024
1 parent e2bde11 commit 19c59fc
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions editor/src/components/canvas/gap-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,31 @@ export function maybeFlexGapData(
info: StyleInfo | null,
element: ElementInstanceMetadata | null,
): FlexGapData | null {
if (element == null || info == null) {
if (
element == null ||
element.specialSizeMeasurements.display !== 'flex' ||
isLeft(element.element) ||
!isJSXElement(element.element.value) ||
info == null
) {
return null
}

const gap = info.gap?.value
const renderedValuePx = element.specialSizeMeasurements.gap
if (gap == null || renderedValuePx == null) {
if (element.specialSizeMeasurements.justifyContent?.startsWith('space')) {
return null
}

const gap = element.specialSizeMeasurements.gap ?? 0
const gapFromReader = info.gap?.value

const flexDirection = element.specialSizeMeasurements.flexDirection ?? 'row'

return {
value: cssNumberWithRenderedValue(gap, renderedValuePx),
direction: info.flexDirection?.value ?? 'row',
value: {
renderedValuePx: gap,
value: gapFromReader ?? null,
},
direction: flexDirection,
}
}

Expand Down

0 comments on commit 19c59fc

Please sign in to comment.