eschutho commented on a change in pull request #14530:
URL: https://github.com/apache/superset/pull/14530#discussion_r629489453
##########
File path: superset-frontend/src/components/Form/index.tsx
##########
@@ -16,8 +16,64 @@
* specific language governing permissions and limitations
* under the License.
*/
+import React from 'react';
+import { Input } from 'antd';
+import { styled } from '@superset-ui/core';
import Form from './Form';
import FormItem from './FormItem';
import FormLabel from './FormLabel';
+interface LabeledErrorBoundInputProps {
+ label?: string;
+ name: string;
+ validationMethods:
+ | { onBlur: (value: any) => void }
+ | { onChange: (value: any) => void };
+ errorMessage: string | null;
+ helpText?: string;
+ value: string | number | readonly string[] | undefined;
+ required?: boolean;
+ placeholder?: string;
+ autocomplete?: string;
+ type?: string;
+ id?: string;
+}
+
+const StyledInput = styled(Input)`
+ margin: 8px 0;
+`;
+
+const LabeledErrorBoundInput = ({
+ label,
+ name,
+ validationMethods,
+ errorMessage,
+ helpText,
+ value,
+ required = false,
+ placeholder,
+ autocomplete,
+ type,
+ id,
+}: LabeledErrorBoundInputProps) => (
+ <>
+ <FormLabel required={required}>{label}</FormLabel>
+ <FormItem
+ name={name}
+ validateTrigger={Object.keys(validationMethods)}
+ validateStatus={errorMessage ? 'error' : 'success'}
+ help={errorMessage || helpText}
+ id={id}
+ placeholder={placeholder}
+ autocomplete={autocomplete}
Review comment:
I would suggest removing this and then just passing through any extra
props that you get.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]