Skip to content

Commit

Permalink
Allow for a tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Kadrian committed Apr 15, 2024
1 parent 2f9c91b commit 6072133
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions frontend/mock-api/forms/export-form.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
"de": "Datenschutz"
},
"creatable": true,
"tooltip": {
"de": "Der Datenschutz ist ein wichtiges Thema, deshalb musst du hier zustimmen."
},
"fields": [
{
"type": "HEADLINE",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/js/external-forms/config-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ export interface Group {

export interface Disclosure {
type: "DISCLOSURE";
name: string;
creatable?: boolean;
defaultOpen?: boolean;
name: string;
label: TranslatableString;
tooltip?: TranslatableString;
fields: GeneralField[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import {
faChevronRight,
} from "@fortawesome/free-solid-svg-icons";
import { ComponentProps, useState } from "react";
import { exists } from "../../../common/helpers/exists";
import FaIcon from "../../../icon/FaIcon";
import InfoTooltip from "../../../tooltip/InfoTooltip";
import { Disclosure } from "../../config-types";
import { getFieldKey } from "../../helper";
import Field from "../Field";
Expand Down Expand Up @@ -55,6 +57,7 @@ export const DisclosureField = ({
<FaIcon icon={isOpen ? faChevronDown : faChevronRight} />
</span>
{field.label[locale]}
{exists(field.tooltip) && <InfoTooltip text={field.tooltip[locale]} />}
</Summary>
<DisclosureNestedFields>
{field.fields.map((f, i) => {
Expand Down

0 comments on commit 6072133

Please sign in to comment.