Skip to content

Commit

Permalink
Add attribute description to Custom Attribute widget input (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbbyB97 authored Aug 23, 2024
1 parent ca9bacf commit 268a3f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.formatTextStyle {
margin-left: 0.75px;
}
22 changes: 13 additions & 9 deletions src/components/Attributes/CustomAttributeWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { useEffect, useMemo, useRef, useState } from 'react';
import { Field, Form } from 'react-final-form';
import { useDispatch, useSelector } from 'react-redux';
import Select from 'react-select';
import { Form as BootstrapForm, Col, Row } from 'reactstrap';
import { Form as BootstrapForm, Col, FormText, Row } from 'reactstrap';
import { LockWidgetNameEnum } from 'types/user-interface';
import { actions as customAttributesActions, selectors as customAttributesSelectors } from '../../../ducks/customAttributes';
import { AttributeResponseModel, BaseAttributeContentModel, CustomAttributeModel } from '../../../types/attributes';
import { Resource } from '../../../types/openapi';
import ContentValueField from '../../Input/DynamicContent/ContentValueField';
import Widget from '../../Widget';
import AttributeViewer, { ATTRIBUTE_VIEWER_TYPE } from '../AttributeViewer';
import style from './customAttributeWidget.module.scss';

export type Props = {
resource: Resource;
Expand Down Expand Up @@ -134,14 +135,17 @@ export default function CustomAttributeWidget({ resource, resourceUuid, attribut
</Col>
<Col xs="6" sm="6" md="6" lg="6" xl="6">
{attribute && (
<ContentValueField
descriptor={attribute}
onSubmit={(uuid, content) => {
form.change('selectCustomAttribute', undefined);
setAttribute(undefined);
addCustomAttribute(uuid, content);
}}
/>
<div>
<ContentValueField
descriptor={attribute}
onSubmit={(uuid, content) => {
form.change('selectCustomAttribute', undefined);
setAttribute(undefined);
addCustomAttribute(uuid, content);
}}
/>
<FormText className={style.formatTextStyle}>{attribute.description}</FormText>
</div>
)}
</Col>
</Row>
Expand Down

0 comments on commit 268a3f2

Please sign in to comment.