Skip to content

Commit

Permalink
[field] Fix spacing between changes and groups of changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and rexxars committed Oct 6, 2020
1 parent b2bd4a4 commit 839825f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
6 changes: 6 additions & 0 deletions packages/@sanity/field/src/diff/components/ChangeList.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
.root {
}

.changeList {
display: grid;
grid-template-columns: minmax(0, 1fr);
grid-gap: 2em;
}

.footer {
margin-top: 2em;
}
Expand Down
8 changes: 5 additions & 3 deletions packages/@sanity/field/src/diff/components/ChangeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ export function ChangeList({diff, fields, schemaType}: Props): React.ReactElemen
className={styles.root}
data-revert-all-changes-hover={confirmRevertAllHover ? '' : undefined}
>
{changes.map(change => (
<ChangeResolver change={change} key={change.key} />
))}
<div className={styles.changeList}>
{changes.map(change => (
<ChangeResolver change={change} key={change.key} />
))}
</div>

{showFooter && (
<div className={styles.footer}>
Expand Down
4 changes: 0 additions & 4 deletions packages/@sanity/field/src/diff/components/FieldChange.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
@import 'part:@sanity/base/theme/variables-style';

.root {
@nest div + & {
margin-top: var(--extra-large-padding);
}
}

.error {
Expand All @@ -12,7 +9,6 @@

.header {
padding: 0 0 var(--extra-small-padding);
margin-left: -1px;
}

.change {
Expand Down
15 changes: 8 additions & 7 deletions packages/@sanity/field/src/diff/components/GroupChange.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
@import 'part:@sanity/base/theme/variables-style';

.groupChange {
margin-top: var(--extra-large-padding);
}

.changeList {
.content {
position: relative;
padding: var(--small-padding) 0 0 var(--small-padding);

Expand All @@ -17,14 +16,16 @@
bottom: 0;
border-left: 1px solid var(--gray-lighter);
}
}

@nest [data-revert-all-changes-hover] &::before {
border-left: 2px solid var(--state-danger-color);
}
.changeList {
display: grid;
grid-template-columns: minmax(0, 1fr);
grid-gap: 2em;
}

.changeListOutlined {
composes: changeList;
.contentOutlined {
composes: content;

@nest &::before {
border-left: 2px solid var(--state-danger-color);
Expand Down
10 changes: 6 additions & 4 deletions packages/@sanity/field/src/diff/components/GroupChange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export function GroupChange({change: group}: {change: GroupChangeNode}): React.R
])

const content = (
<div className={isHoveringRevert ? styles.changeListOutlined : styles.changeList}>
{changes.map(change => (
<ChangeResolver key={change.key} change={change} />
))}
<div className={isHoveringRevert ? styles.contentOutlined : styles.content}>
<div className={styles.changeList}>
{changes.map(change => (
<ChangeResolver key={change.key} change={change} />
))}
</div>

{isComparingCurrent && (
<div ref={hoverRef} className={styles.revertChangesButtonContainer}>
Expand Down

0 comments on commit 839825f

Please sign in to comment.