Skip to content

Commit 25ff7b0

Browse files
committed
Ensure that Add component honors mods.tooltipDescriptions.add
1 parent f03f7c8 commit 25ff7b0

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

src/formBuilder/Add.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ const useStyles = createUseStyles({
3737
export default function Add({
3838
addElem,
3939
hidden,
40+
tooltipDescription,
4041
}: {
4142
addElem: (choice: string) => void,
4243
hidden?: boolean,
44+
tooltipDescription?: string,
4345
}): Node {
4446
const classes = useStyles();
4547
const [popoverOpen, setPopoverOpen] = useState(false);
@@ -55,7 +57,7 @@ export default function Add({
5557
/>
5658
</span>
5759
<UncontrolledTooltip placement='top' target={`${elementId}_add`}>
58-
Create new form element
60+
{tooltipDescription || 'Create new form element'}
5961
</UncontrolledTooltip>
6062
<Popover
6163
placement='bottom'

src/formBuilder/Card.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ export default function Card({
249249
TypeSpecificParameters={TypeSpecificParameters}
250250
/>
251251
</Collapse>
252-
{addElem ? <Add addElem={(choice: string) => addElem(choice)} /> : ''}
252+
{addElem ? (
253+
<Add
254+
tooltipDescription={((mods || {}).tooltipDescriptions || {}).add}
255+
addElem={(choice: string) => addElem(choice)}
256+
/>
257+
) : (
258+
''
259+
)}
253260
</React.Fragment>
254261
);
255262
}

src/formBuilder/CardGallery.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default function CardGallery({
7777
{componentArr.length === 0 && <h5>No components in "definitions"</h5>}
7878
<div className='form_footer'>
7979
<Add
80+
tooltipDescription={((mods || {}).tooltipDescriptions || {}).add}
8081
addElem={(choice: string) => {
8182
if (choice === 'card') {
8283
addCardObj({

src/formBuilder/FormBuilder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ export default function FormBuilder({
348348
</div>
349349
<div className={`form-footer ${classes.formFooter}`}>
350350
<Add
351+
tooltipDescription={((mods || {}).tooltipDescriptions || {}).add}
351352
addElem={(choice: string) => {
352353
if (choice === 'card') {
353354
addCardObj({

src/formBuilder/Section.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ export default function Section({
438438
</div>
439439
<div className='section-footer'>
440440
<Add
441+
tooltipDescription={((mods || {}).tooltipDescriptions || {}).add}
441442
addElem={(choice: string) => {
442443
if (choice === 'card') {
443444
addCardObj({
@@ -520,7 +521,14 @@ export default function Section({
520521
TypeSpecificParameters={CardDefaultParameterInputs}
521522
/>
522523
</Collapse>
523-
{addElem ? <Add addElem={(choice: string) => addElem(choice)} /> : ''}
524+
{addElem ? (
525+
<Add
526+
tooltipDescription={((mods || {}).tooltipDescriptions || {}).add}
527+
addElem={(choice: string) => addElem(choice)}
528+
/>
529+
) : (
530+
''
531+
)}
524532
</React.Fragment>
525533
);
526534
}

0 commit comments

Comments
 (0)