Skip to content

Commit

Permalink
fix(space): remove last element margin (#713)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Yatsenko <reme3d2y@gmail.com>
  • Loading branch information
grewar and reme3d2y committed Jun 28, 2021
1 parent a6749a1 commit bc36cf7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/space/src/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ const Item = (props: ItemProps) => {
let style: React.CSSProperties = {};

if (direction === 'vertical') {
if (index < length) {
if (index < length - 1) {
style = { marginBottom: horizontalSize / (divider ? 2 : 1) };
}
} else {
style = {
...(index < length && { marginRight: horizontalSize / (divider ? 2 : 1) }),
...(index < length - 1 && { marginRight: horizontalSize / (divider ? 2 : 1) }),
...(wrap && { paddingBottom: verticalSize }),
};
}
Expand Down
4 changes: 0 additions & 4 deletions packages/space/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Object {
>
<div
class="spaceItem"
style="margin-bottom: 16px;"
>
<div
class="cardImage rounded"
Expand All @@ -35,7 +34,6 @@ Object {
>
<div
class="spaceItem"
style="margin-bottom: 16px;"
>
<div
class="cardImage rounded"
Expand Down Expand Up @@ -123,7 +121,6 @@ Object {
</div>
<div
class="spaceItem"
style="margin-bottom: 16px;"
/>
</div>
</div>
Expand All @@ -140,7 +137,6 @@ Object {
</div>
<div
class="spaceItem"
style="margin-bottom: 16px;"
/>
</div>
</div>,
Expand Down

0 comments on commit bc36cf7

Please sign in to comment.