-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[form-builder] Slight refactor of
ArrayInput
* Split `ArrayInputItem` into 2 components – `ArrayInputGridItem` and `ArrayInputListItem`. These components have separate layouts, and solving that with CSS only was causing issues. * Improve readability of component code by adding newlines between methods, consts, and return bodies. * Add a `className` property to `ArrayFunctions` to avoid importing the same CSS module in multiple components (which is a bad pattern).
- Loading branch information
1 parent
c392246
commit de5ae2e
Showing
13 changed files
with
579 additions
and
135 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/@sanity/form-builder/src/inputs/ArrayInput/ArrayFunctions.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.root { | ||
composes: functions from 'part:@sanity/components/fieldsets/default-style'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
packages/@sanity/form-builder/src/inputs/ArrayInput/item/ArrayInputGridItem.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
@import 'part:@sanity/base/theme/variables-style'; | ||
|
||
.root { | ||
position: relative; | ||
} | ||
|
||
.inner { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
.innerWithError { | ||
composes: inner; | ||
} | ||
|
||
.popupAnchor { | ||
/* | ||
This is where the popover sticks to | ||
*/ | ||
position: absolute; | ||
top: 0%; | ||
left: 0%; | ||
width: 100%; | ||
height: 100%; | ||
background-color: var(--selectable-item-color-highlighted); | ||
} | ||
|
||
.editRootFold { | ||
position: relative; | ||
width: calc(100% + var(--medium-padding) * 2); | ||
margin-left: calc(var(--medium-padding) * -1); | ||
} | ||
|
||
.missingKeyMessage { | ||
color: var(--state-warning-color); | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
z-index: 200; | ||
padding: var(--extra-small-padding) var(--small-padding); | ||
background-color: var(--input-bg); | ||
} | ||
|
||
.dragHandle { | ||
display: block; | ||
flex-grow: 0; | ||
margin-right: var(--extra-small-padding); | ||
|
||
@nest & > button { | ||
cursor: ns-resize; | ||
} | ||
} | ||
|
||
.linkToReference { | ||
} | ||
|
||
.previewWrapper { | ||
composes: listItemStates from 'part:@sanity/base/theme/layout/backgrounds-style'; | ||
border-radius: var(--border-radius-base); | ||
flex-grow: 1; | ||
outline: none; | ||
user-select: none; | ||
min-width: 0; | ||
|
||
@nest &:focus { | ||
box-shadow: var(--input-box-shadow--focus); | ||
} | ||
} | ||
|
||
.previewWrapperHelper { | ||
outline: none; | ||
} | ||
|
||
.previewWrapperHelper:focus { | ||
@nest .innerWithError & { | ||
box-shadow: var(--input-box-shadow--invalid-focus); | ||
} | ||
} | ||
|
||
.functions { | ||
position: absolute; | ||
z-index: 1; | ||
display: flex; | ||
align-items: center; | ||
flex-grow: 0; | ||
top: var(--extra-small-padding); | ||
right: var(--extra-small-padding); | ||
color: var(--text-color); | ||
|
||
@nest & > * { | ||
margin: 0; | ||
} | ||
|
||
@media (hover: hover) { | ||
display: none; | ||
|
||
@nest .root:hover & { | ||
display: block; | ||
} | ||
} | ||
} | ||
|
||
.validationIconError { | ||
composes: validationIconError from 'part:@sanity/base/theme/forms/validation-style'; | ||
} |
Oops, something went wrong.