fix(react): fix jitter on schema when adding description (#3230)

This commit is contained in:
Gabe Lyons 2021-09-13 14:35:06 -07:00 committed by GitHub
parent 32c170adfa
commit 96e8eb4e3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 18 deletions

View File

@ -1,4 +1,4 @@
import { Typography, message, Tag } from 'antd';
import { Typography, message, Button } from 'antd';
import { EditOutlined } from '@ant-design/icons';
import React, { useState } from 'react';
import styled from 'styled-components';
@ -14,9 +14,10 @@ const EditIcon = styled(EditOutlined)`
display: none;
`;
const AddNewDescription = styled(Tag)`
cursor: pointer;
const AddNewDescription = styled(Button)`
display: none;
margin: -4px;
width: 140px;
`;
const ExpandedActions = styled.div`
@ -112,6 +113,8 @@ export default function DescriptionField({
(editable && description && <EditIcon twoToneColor="#52c41a" onClick={() => setShowAddModal(true)} />) ||
undefined;
const showAddDescription = editable && !description;
return (
<DescriptionContainer
onClick={(e) => {
@ -121,19 +124,21 @@ export default function DescriptionField({
>
{expanded ? (
<>
<DescriptionText source={description} />
<ExpandedActions>
{overLimit && (
<ReadLessText
onClick={() => {
setExpanded(false);
}}
>
Read Less
</ReadLessText>
)}
{EditButton}
</ExpandedActions>
{!!description && <DescriptionText source={description} />}
{!!description && (
<ExpandedActions>
{overLimit && (
<ReadLessText
onClick={() => {
setExpanded(false);
}}
>
Read Less
</ReadLessText>
)}
{EditButton}
</ExpandedActions>
)}
</>
) : (
<>
@ -169,8 +174,8 @@ export default function DescriptionField({
/>
</div>
)}
{editable && !description && (
<AddNewDescription color="success" onClick={() => setShowAddModal(true)}>
{showAddDescription && (
<AddNewDescription type="text" onClick={() => setShowAddModal(true)}>
+ Add Description
</AddNewDescription>
)}

View File

@ -745,6 +745,18 @@
},
"nativeDataType": "boolean",
"recursive": false
},
{
"fieldPath": "browser",
"jsonPath": null,
"nullable": false,
"type": {
"type": {
"com.linkedin.pegasus2avro.schema.StringType": {}
}
},
"nativeDataType": "string",
"recursive": false
}
],
"primaryKeys": null,