mirror of
https://github.com/Redocly/redoc.git
synced 2025-10-27 05:51:07 +03:00
* fix: No maxLength label is displayed for arrays of items #1701
* Revert "fix: No maxLength label is displayed for arrays of items #1701"
This reverts commit 543ecc4d39.
* fix: No maxLength label is displayed for arrays of items #1701
* change array items display
* fix alignment
* remove theme font from labels
* update snapshot
Co-authored-by: Oprysk <vyacheslav@redocly.com>
25 lines
595 B
TypeScript
25 lines
595 B
TypeScript
import * as React from 'react';
|
|
import { ExampleValue, FieldLabel } from '../../common-elements/fields';
|
|
|
|
export interface FieldDetailProps {
|
|
value?: any;
|
|
label: string;
|
|
raw?: boolean;
|
|
}
|
|
|
|
function FieldDetailComponent({ value, label, raw }: FieldDetailProps) {
|
|
if (value === undefined) {
|
|
return null;
|
|
}
|
|
|
|
const stringifyValue = raw ? String(value) : JSON.stringify(value);
|
|
|
|
return (
|
|
<div>
|
|
<FieldLabel> {label} </FieldLabel> <ExampleValue>{stringifyValue}</ExampleValue>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export const FieldDetail = React.memo<FieldDetailProps>(FieldDetailComponent);
|