Skip to content

Commit f011f98

Browse files
vishalshrm539Vishal
andauthored
Fix User Reference not working as expected in Details template (#354)
Co-authored-by: Vishal <[email protected]>
1 parent bb01bfd commit f011f98

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/react-sdk-components/src/components/field/UserReference/UserReference.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Typography } from '@material-ui/core';
44
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
55
import { PConnProps } from '../../../types/PConnProps';
66

7+
import FieldValueList from '../../designSystemExtension/FieldValueList';
78
import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
89

910
const DROPDOWN_LIST = 'Drop-down list';
@@ -12,6 +13,7 @@ const SEARCH_BOX = 'Search box';
1213
interface UserReferenceProps extends PConnProps {
1314
// If any, enter additional props that only exist on URLComponent here
1415
displayAs?: string;
16+
displayMode?: string;
1517
label?: string;
1618
value?: any;
1719
testId?: string;
@@ -36,6 +38,7 @@ const UserReference = (props: UserReferenceProps) => {
3638
const {
3739
label = '',
3840
displayAs = '',
41+
displayMode = '',
3942
getPConnect,
4043
value = '',
4144
testId = '',
@@ -96,6 +99,14 @@ const UserReference = (props: UserReferenceProps) => {
9699

97100
let userReferenceComponent: any = null;
98101

102+
if (displayMode === 'LABELS_LEFT') {
103+
return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} />;
104+
}
105+
106+
if (displayMode === 'STACKED_LARGE_VAL') {
107+
return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} variant='stacked' />;
108+
}
109+
99110
if (readOnly && showAsFormattedText) {
100111
if (userId) {
101112
userReferenceComponent = (
@@ -172,7 +183,6 @@ const UserReference = (props: UserReferenceProps) => {
172183
);
173184
}
174185
}
175-
176186
return userReferenceComponent;
177187
};
178188

0 commit comments

Comments
 (0)