Skip to content

Commit

Permalink
Display help always under the label
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Nov 15, 2024
1 parent ad35c9d commit 7045da1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,6 @@ function FieldBlock(props: Props) {
: labelDescription
const hasHelp = help?.title || help?.content

const helpNode = (
<HelpButtonInlineContent
contentId={`${id}-help`}
className="dnb-forms-field-block__help"
help={help}
/>
)

return (
<FieldBlockContext.Provider
value={{
Expand All @@ -557,8 +549,6 @@ function FieldBlock(props: Props) {
className={mainClasses}
{...rest}
>
{hasHelp && layout === 'horizontal' && helpNode}

<div className={gridClasses}>
{(label || labelDescription || hasHelp) && (
<FormLabel {...labelProps}>
Expand All @@ -582,7 +572,13 @@ function FieldBlock(props: Props) {
</FormLabel>
)}

{hasHelp && helpNode}
{hasHelp && (
<HelpButtonInlineContent
contentId={`${id}-help`}
className="dnb-forms-field-block__help"
help={help}
/>
)}

<div
className={classnames(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ fieldset.dnb-forms-field-block {
auto;
grid-template-areas:
'label contents'
'help help'
'. indicator'
'. status';

Expand All @@ -126,17 +127,6 @@ fieldset.dnb-forms-field-block {
}
}

&__help:has(+ #{&}__grid#{&}--layout-horizontal) {
@include allBelow(small) {
display: none;
}
}
&__grid#{&}--layout-horizontal &__help {
@include allAbove(small) {
display: none;
}
}

&__indicator {
grid-area: indicator;
}
Expand All @@ -154,6 +144,14 @@ fieldset.dnb-forms-field-block {
}
}
}
&__grid#{&}--layout-horizontal &__help {
@include allAbove(small) {
.dnb-section {
margin-top: 0.5rem;
margin-bottom: 0;
}
}
}

&__status {
grid-area: status;
Expand Down

0 comments on commit 7045da1

Please sign in to comment.