Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 8a81124

Browse files
committed
fix: fix Row behaviour
1 parent 77db04b commit 8a81124

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/shared/core/Row.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types'
22
import { mr, ml } from '@smooth-ui/system'
33
import { css } from './styled-engine'
44
import { gridGutter } from './theming/index'
5+
import { negative } from './utils/unit'
56
import { getSystemPropTypes } from './utils/propTypes'
67
import createComponent from './createComponent'
78

@@ -10,13 +11,14 @@ const Row = createComponent(() => ({
1011
omitProps: ['gutter'],
1112
style: p => {
1213
const { gutter = gridGutter(p) } = p
14+
const negativeGutter = negative(gutter)
1315
return css`
1416
box-sizing: border-box;
1517
flex-grow: 1;
1618
flex-wrap: wrap;
1719
display: flex;
18-
${ml({ ml: gutter })(p)}
19-
${mr({ mr: gutter })(p)}
20+
${ml({ ml: negativeGutter })(p)}
21+
${mr({ mr: negativeGutter })(p)}
2022
`
2123
},
2224
propTypes: {

packages/shared/core/utils/unit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { num } from './misc'
22

33
export const unit = unit => value => (num(value) ? `${value}${unit}` : value)
4+
export const negative = value => (num(value) ? -value : `-${value}`)
45

56
export const px = unit('px')
67

0 commit comments

Comments
 (0)