Chore: Avoid explicit React.FC<Props> when possible (round 2) (#64749)

This commit is contained in:
Ryan McKinley
2023-03-15 07:56:09 -07:00
committed by GitHub
parent 1a16636692
commit 4f13e78d11
147 changed files with 364 additions and 449 deletions

View File

@@ -13,7 +13,7 @@ interface SaveDashboardButtonProps {
size?: ComponentSize;
}
export const SaveDashboardButton: React.FC<SaveDashboardButtonProps> = ({ dashboard, onSaveSuccess, size }) => {
export const SaveDashboardButton = ({ dashboard, onSaveSuccess, size }: SaveDashboardButtonProps) => {
return (
<ModalsController>
{({ showModal, hideModal }) => {
@@ -37,12 +37,9 @@ export const SaveDashboardButton: React.FC<SaveDashboardButtonProps> = ({ dashbo
);
};
export const SaveDashboardAsButton: React.FC<SaveDashboardButtonProps & { variant?: ButtonVariant }> = ({
dashboard,
onSaveSuccess,
variant,
size,
}) => {
type Props = SaveDashboardButtonProps & { variant?: ButtonVariant };
export const SaveDashboardAsButton = ({ dashboard, onSaveSuccess, variant, size }: Props) => {
return (
<ModalsController>
{({ showModal, hideModal }) => {

View File

@@ -19,12 +19,12 @@ interface SaveDashboardErrorProxyProps {
onDismiss: () => void;
}
export const SaveDashboardErrorProxy: React.FC<SaveDashboardErrorProxyProps> = ({
export const SaveDashboardErrorProxy = ({
dashboard,
dashboardSaveModel,
error,
onDismiss,
}) => {
}: SaveDashboardErrorProxyProps) => {
const { onDashboardSave } = useDashboardSave(dashboard);
useEffect(() => {

View File

@@ -14,12 +14,7 @@ interface UnsavedChangesModalProps {
onSaveSuccess?: () => void;
}
export const UnsavedChangesModal: React.FC<UnsavedChangesModalProps> = ({
dashboard,
onSaveSuccess,
onDiscard,
onDismiss,
}) => {
export const UnsavedChangesModal = ({ dashboard, onSaveSuccess, onDiscard, onDismiss }: UnsavedChangesModalProps) => {
return (
<Modal
isOpen={true}

View File

@@ -38,13 +38,7 @@ export interface SaveDashboardAsFormProps extends SaveDashboardFormProps {
isNew?: boolean;
}
export const SaveDashboardAsForm: React.FC<SaveDashboardAsFormProps> = ({
dashboard,
isNew,
onSubmit,
onCancel,
onSuccess,
}) => {
export const SaveDashboardAsForm = ({ dashboard, isNew, onSubmit, onCancel, onSuccess }: SaveDashboardAsFormProps) => {
const defaultValues: SaveDashboardAsFormDTO = {
title: isNew ? dashboard.title : `${dashboard.title} Copy`,
$folder: {

View File

@@ -7,7 +7,7 @@ import { Button, ClipboardButton, HorizontalGroup, TextArea } from '@grafana/ui'
import { SaveDashboardFormProps } from '../types';
export const SaveProvisionedDashboardForm: React.FC<SaveDashboardFormProps> = ({ dashboard, onCancel }) => {
export const SaveProvisionedDashboardForm = ({ dashboard, onCancel }: SaveDashboardFormProps) => {
const [dashboardJSON, setDashboardJson] = useState(() => {
const clone = dashboard.getSaveModelClone();
delete clone.id;