Chore: replace React.FC<Props> with simple function component (#54123)

This commit is contained in:
Ryan McKinley
2022-08-24 13:54:34 -07:00
committed by GitHub
parent 277ea836b6
commit b483ac322f
53 changed files with 63 additions and 76 deletions

View File

@@ -58,7 +58,7 @@ const getCopiedPanelPlugins = () => {
return sortBy(copiedPanels, 'sort');
};
export const AddPanelWidgetUnconnected: React.FC<Props> = ({ panel, dashboard }) => {
export const AddPanelWidgetUnconnected = ({ panel, dashboard }: Props) => {
const [addPanelView, setAddPanelView] = useState(false);
const onCancelAddPanel = (evt: React.MouseEvent<HTMLButtonElement>) => {

View File

@@ -19,7 +19,7 @@ type Props = {
export const newAnnotationName = 'New annotation';
export const AnnotationSettingsEdit: React.FC<Props> = ({ editIdx, dashboard }) => {
export const AnnotationSettingsEdit = ({ editIdx, dashboard }: Props) => {
const [annotation, setAnnotation] = useState(dashboard.annotations.list[editIdx]);
const { value: ds } = useAsync(() => {

View File

@@ -14,7 +14,7 @@ type Props = {
onEdit: (idx: number) => void;
};
export const AnnotationSettingsList: React.FC<Props> = ({ dashboard, onNew, onEdit }) => {
export const AnnotationSettingsList = ({ dashboard, onNew, onEdit }: Props) => {
const [annotations, updateAnnotations] = useState(dashboard.annotations.list);
const onMove = (idx: number, direction: number) => {

View File

@@ -24,7 +24,7 @@ const connector = connect(null, mapDispatchToProps);
type Props = DeleteDashboardModalProps & ConnectedProps<typeof connector>;
const DeleteDashboardModalUnconnected: React.FC<Props> = ({ hideModal, cleanUpDashboardAndVariables, dashboard }) => {
const DeleteDashboardModalUnconnected = ({ hideModal, cleanUpDashboardAndVariables, dashboard }: Props) => {
const isProvisioned = dashboard.meta.provisioned;
const { onDeleteDashboard } = useDashboardDelete(dashboard.uid, cleanUpDashboardAndVariables);

View File

@@ -31,7 +31,7 @@ interface Props {
onClose: () => void;
}
export const InspectContent: React.FC<Props> = ({
export const InspectContent = ({
panel,
plugin,
dashboard,
@@ -43,7 +43,7 @@ export const InspectContent: React.FC<Props> = ({
defaultTab,
onDataOptionsChange,
onClose,
}) => {
}: Props) => {
const [currentTab, setCurrentTab] = useState(defaultTab ?? InspectTab.Data);
if (!plugin) {

View File

@@ -26,7 +26,7 @@ export interface ConnectedProps {
export type Props = OwnProps & ConnectedProps;
const PanelInspectorUnconnected: React.FC<Props> = ({ panel, dashboard, plugin }) => {
const PanelInspectorUnconnected = ({ panel, dashboard, plugin }: Props) => {
const [dataOptions, setDataOptions] = useState<GetDataOptions>({
withTransforms: false,
withFieldConfig: true,

View File

@@ -18,7 +18,7 @@ interface Props {
dashboardId: number;
}
export const DashboardLinksDashboard: React.FC<Props> = (props) => {
export const DashboardLinksDashboard = (props: Props) => {
const { link, linkInfo } = props;
const listRef = useRef<HTMLUListElement>(null);
const [dropdownCssClass, setDropdownCssClass] = useState('invisible');