Skip to content

Commit 14a6c12

Browse files
authored
Merge pull request #4328 from czwe-01/thulasizwe/b/75986
Thulasizwe/b/75986
2 parents 11ef0a4 + 8393950 commit 14a6c12

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

shesha-reactjs/src/components/readOnlyDisplayFormItem/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const ReadOnlyDisplayFormItem: FC<IReadOnlyDisplayFormItemProps> = (props
101101
return dropdownDisplayMode === 'raw'
102102
? <InputField style={style} value={values?.join(', ')} />
103103
: (
104-
<div style={{ padding: '0px 4px', ...style, display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 8, justifyContent: style?.textAlign }}>
104+
<div className={styles.wrapper} style={{ ...style }}>
105105
{value?.map(({ label, color, icon, value, description }) => {
106106
return (
107107
<ReflistTag

shesha-reactjs/src/components/readOnlyDisplayFormItem/inputField.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ interface IInputFieldProps {
88
}
99

1010
function InputField({ value, style, children }: IInputFieldProps): JSX.Element {
11-
const { styles } = useStyles();
11+
const { styles } = useStyles({ textAlign: style?.textAlign || 'left' });
1212

13-
const { fontSize, fontWeight, color, fontFamily, textAlign, height } = style || {};
13+
const { fontSize, fontWeight, color, fontFamily, height } = style || {};
1414

1515
return value || children ? (
16-
<div style={{ padding: '4px', ...style, height: height, display: 'flex', alignItems: 'center', justifyContent: textAlign }}>
16+
<div style={{ ...style }} className={styles.wrapper}>
1717
<div className={styles.inputField} style={{ fontSize, fontWeight, color, fontFamily, whiteSpace: height === 'auto' ? 'pre-wrap' : 'nowrap', flex: 'none' }}>{value || children}</div>
1818
</div>
1919
) : null;

shesha-reactjs/src/components/readOnlyDisplayFormItem/styles/styles.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { createStyles, sheshaStyles, getTextHoverEffects } from '@/styles';
2+
import { CSSProperties } from 'react';
23

4+
interface UseStylesParams {
5+
textAlign?: CSSProperties['textAlign'];
6+
}
7+
8+
export const useStyles = createStyles(({ css, cx, prefixCls, token }, params: UseStylesParams) => {
9+
const { textAlign } = params;
310

4-
export const useStyles = createStyles(({ css, cx, prefixCls, token }) => {
511
const readOnlyModeToggler = "read-only-mode-toggler";
612
const readOnlyDisplayFormItem = cx("read-only-display-form-item", css`
713
width: 100%;
@@ -56,9 +62,20 @@ export const useStyles = createStyles(({ css, cx, prefixCls, token }) => {
5662
// white-space: nowrap;
5763
`;
5864

65+
const wrapper = css`
66+
display: flex;
67+
flex-wrap: wrap;
68+
align-items: center;
69+
gap: 8px;
70+
padding: 4px;
71+
box-sizing: border-box;
72+
justify-content: ${textAlign === 'center' ? 'center' : textAlign === 'right' ? 'flex-end' : 'flex-start'};
73+
`;
74+
5975
return {
6076
readOnlyDisplayFormItem,
6177
readOnlyModeToggler,
6278
inputField,
79+
wrapper,
6380
};
64-
});
81+
});

0 commit comments

Comments
 (0)