mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
fix lint.
This commit is contained in:
parent
199e7b03f0
commit
29d9fdc1ce
@ -3,7 +3,7 @@ import 'CommonUI/src/Styles/Bootstrap';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import App from './App';
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
const root: any = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement
|
||||
);
|
||||
|
||||
|
@ -16,7 +16,7 @@ const TopBar: FunctionComponent<ComponentProps> = ({
|
||||
rightContents,
|
||||
middleContents,
|
||||
navContents,
|
||||
}): ReactElement => {
|
||||
}: ComponentProps): ReactElement => {
|
||||
return (
|
||||
<div className="root">
|
||||
<header>
|
||||
|
@ -12,7 +12,7 @@ export interface ComponentProps {
|
||||
const MenuLinkItem: FunctionComponent<ComponentProps> = ({
|
||||
text,
|
||||
openInNewTab,
|
||||
}): ReactElement => {
|
||||
}: ComponentProps): ReactElement => {
|
||||
return (
|
||||
<div className="menu-link">
|
||||
<div className="name">
|
||||
|
@ -8,20 +8,26 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
|
||||
import './MenuButton.scss';
|
||||
|
||||
export interface ComponentProps {
|
||||
text?: string;
|
||||
export interface MenuIconButtonComponentProps {
|
||||
icon?: IconProp;
|
||||
action?: MouseEventHandler;
|
||||
modalContent?: ReactElement;
|
||||
showModal?: boolean;
|
||||
}
|
||||
|
||||
export const MenuIconButton: FunctionComponent<ComponentProps> = ({
|
||||
export interface MenuOutlineButtonComponentProps
|
||||
extends MenuIconButtonComponentProps {
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export const MenuIconButton: FunctionComponent<
|
||||
MenuIconButtonComponentProps
|
||||
> = ({
|
||||
icon,
|
||||
action,
|
||||
showModal,
|
||||
modalContent,
|
||||
}: ComponentProps): ReactElement => {
|
||||
}: MenuIconButtonComponentProps): ReactElement => {
|
||||
return (
|
||||
<div className="button-layout">
|
||||
<div className="icon-button" onClick={action}>
|
||||
@ -32,13 +38,15 @@ export const MenuIconButton: FunctionComponent<ComponentProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const MenuOutlineButton: FunctionComponent<ComponentProps> = ({
|
||||
export const MenuOutlineButton: FunctionComponent<
|
||||
MenuOutlineButtonComponentProps
|
||||
> = ({
|
||||
text,
|
||||
icon,
|
||||
action,
|
||||
showModal,
|
||||
modalContent,
|
||||
}: ComponentProps): ReactElement => {
|
||||
}: MenuOutlineButtonComponentProps): ReactElement => {
|
||||
return (
|
||||
<div className="button-layout">
|
||||
<div className="button" onClick={action}>
|
||||
@ -50,13 +58,13 @@ export const MenuOutlineButton: FunctionComponent<ComponentProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
const MenuButton: FunctionComponent<ComponentProps> = ({
|
||||
const MenuButton: FunctionComponent<MenuOutlineButtonComponentProps> = ({
|
||||
text,
|
||||
icon,
|
||||
action,
|
||||
showModal,
|
||||
modalContent,
|
||||
}): ReactElement => {
|
||||
}: MenuOutlineButtonComponentProps): ReactElement => {
|
||||
return (
|
||||
<div className="button-layout">
|
||||
<div className="menu-button" onClick={action}>
|
||||
|
@ -63,11 +63,10 @@ const BasicForm: FunctionComponent = <T extends Object>(
|
||||
<span>
|
||||
<a
|
||||
href={field.sideLink?.url.toString()}
|
||||
target={`${
|
||||
field.sideLink?.openLinkInNewTab
|
||||
target={`${field.sideLink?.openLinkInNewTab
|
||||
? '_blank'
|
||||
: '_self'
|
||||
}`}
|
||||
}`}
|
||||
>
|
||||
{field.sideLink?.text}
|
||||
</a>
|
||||
@ -104,17 +103,15 @@ const BasicForm: FunctionComponent = <T extends Object>(
|
||||
if (field.validation) {
|
||||
if (field.validation.minLength) {
|
||||
if (content.trim().length < field.validation?.minLength) {
|
||||
return `${field.title || name} cannot be less than ${
|
||||
field.validation.minLength
|
||||
} characters.`;
|
||||
return `${field.title || name} cannot be less than ${field.validation.minLength
|
||||
} characters.`;
|
||||
}
|
||||
}
|
||||
|
||||
if (field.validation.maxLength) {
|
||||
if (content.trim().length > field.validation?.maxLength) {
|
||||
return `${field.title || name} cannot be more than ${
|
||||
field.validation.maxLength
|
||||
} characters.`;
|
||||
return `${field.title || name} cannot be more than ${field.validation.maxLength
|
||||
} characters.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,7 +138,7 @@ const BasicForm: FunctionComponent = <T extends Object>(
|
||||
field.validation?.toMatchField &&
|
||||
entity[field.validation?.toMatchField] &&
|
||||
(entity[field.validation?.toMatchField] as string).trim() !==
|
||||
content.trim()
|
||||
content.trim()
|
||||
) {
|
||||
return `${field.title} should match ${field.validation?.toMatchField}`;
|
||||
}
|
||||
@ -238,42 +235,34 @@ const BasicForm: FunctionComponent = <T extends Object>(
|
||||
setSubmitting(false);
|
||||
}}
|
||||
>
|
||||
{({
|
||||
isSubmitting,
|
||||
isValid,
|
||||
}: {
|
||||
isSubmitting: boolean;
|
||||
isValid: boolean;
|
||||
}) => {
|
||||
return (
|
||||
<Form
|
||||
autoComplete="off"
|
||||
className={`grid_form_${props.showAsColumns}`}
|
||||
>
|
||||
<h1>{props.title}</h1>
|
||||
|
||||
<p className="description">{props.description}</p>
|
||||
<Form
|
||||
autoComplete="off"
|
||||
className={`grid_form_${props.showAsColumns}`}
|
||||
>
|
||||
<h1>{props.title}</h1>
|
||||
|
||||
<p className="description">{props.description}</p>
|
||||
|
||||
<div className={`grid_${props.showAsColumns}`}>
|
||||
{props.fields &&
|
||||
props.fields.map(
|
||||
(field: DataField<T>, i: number) => {
|
||||
return getFormField(field, i);
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
title={props.submitButtonText || 'Submit'}
|
||||
type={ButtonTypes.Submit}
|
||||
id={`${props.id}-submit-button`}
|
||||
isLoading={props.isLoading || false}
|
||||
/>
|
||||
{props.footer}
|
||||
</Form>
|
||||
|
||||
<div className={`grid_${props.showAsColumns}`}>
|
||||
{props.fields &&
|
||||
props.fields.map(
|
||||
(field: DataField<T>, i: number) => {
|
||||
return getFormField(field, i);
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
title={props.submitButtonText || 'Submit'}
|
||||
disabled={isSubmitting || !isValid}
|
||||
type={ButtonTypes.Submit}
|
||||
id={`${props.id}-submit-button`}
|
||||
isLoading={props.isLoading || false}
|
||||
/>
|
||||
{props.footer}
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
</Formik>
|
||||
</div>
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ import 'CommonUI/src/Styles/Bootstrap';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import App from './App';
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
const root: any = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user