Skip to content

Commit

Permalink
[components] Align validation status element
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and rexxars committed Oct 6, 2020
1 parent be4e960 commit 1828849
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/@sanity/components/src/@types/parts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ declare module 'part:@sanity/base/visibility-icon' {
declare module 'part:@sanity/base/warning-icon' {
export {default} from '@sanity/base/src/components/icons/Warning'
}
declare module 'part:@sanity/base/warning-outline-icon' {
export {default} from '@sanity/base/src/components/icons/WarningOutline'
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// Because `@sanity/components` depends on `@sanity/base` we need these "ambient" definitions
Expand Down
10 changes: 10 additions & 0 deletions packages/@sanity/components/src/fieldsets/DefaultFieldset.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@
cursor: default;
}

.labelContainer {
outline: none;
display: flex;
align-items: center;
}

.validationStatus {
margin: -5px 0 -4px;
}

.label {
padding-right: var(--small-padding);
}
Expand Down
5 changes: 3 additions & 2 deletions packages/@sanity/components/src/fieldsets/DefaultFieldset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ export default class Fieldset extends React.PureComponent<FieldsetProps, State>
onKeyDown={event => (event.key === 'Enter' ? this.handleToggle() : false)}
>
<div
tabIndex={-1}
className={styles.labelContainer}
onClick={isCollapsible ? this.handleToggle : undefined}
style={{outline: 'none', display: 'flex', alignItems: 'center'}}
tabIndex={-1}
>
{isCollapsible && (
<div className={`${styles.arrow} ${isCollapsed ? '' : styles.isOpen}`}>
Expand All @@ -171,6 +171,7 @@ export default class Fieldset extends React.PureComponent<FieldsetProps, State>
</DefaultLabel>
</div>
<ValidationStatus
className={styles.validationStatus}
markers={
showSummary
? validation.filter(marker => marker.path.length <= level)
Expand Down

0 comments on commit 1828849

Please sign in to comment.