mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-26 01:18:20 +00:00
fix(react): fix jitter on schema when adding description (#3230)
This commit is contained in:
parent
32c170adfa
commit
96e8eb4e3c
@ -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>
|
||||
)}
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user