migrate ui-components from flow to typescript

This commit is contained in:
Sebastian Sdorra
2019-10-20 16:59:02 +02:00
parent c41efbdc4f
commit f49e17a3a7
151 changed files with 2039 additions and 25265 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { Me } from '@scm-manager/ui-types';
import { Link } from 'react-router-dom';
import React from "react";
import { Me } from "@scm-manager/ui-types";
import { Link } from "react-router-dom";
type Props = {
me?: Me;
@@ -10,13 +10,13 @@ class Footer extends React.Component<Props> {
render() {
const { me } = this.props;
if (!me) {
return '';
return "";
}
return (
<footer className="footer">
<div className="container is-centered">
<p className="has-text-centered">
<Link to={'/me'}>{me.displayName}</Link>
<Link to={"/me"}>{me.displayName}</Link>
</p>
</div>
</footer>

View File

@@ -1,8 +1,8 @@
import * as React from 'react';
import Logo from './../Logo';
import React, { ReactNode } from "react";
import Logo from "./../Logo";
type Props = {
children?: React.Node;
children?: ReactNode;
};
class Header extends React.Component<Props> {

View File

@@ -1,17 +1,17 @@
import * as React from 'react';
import classNames from 'classnames';
import React, { ReactNode } from "react";
import classNames from "classnames";
type Props = {
className?: string;
left?: React.Node;
right?: React.Node;
left?: ReactNode;
right?: ReactNode;
};
export default class Level extends React.Component<Props> {
render() {
const { className, left, right } = this.props;
return (
<div className={classNames('level', className)}>
<div className={classNames("level", className)}>
<div className="level-left">{left}</div>
<div className="level-right">{right}</div>
</div>

View File

@@ -1,12 +1,12 @@
import * as React from 'react';
import classNames from 'classnames';
import styled from 'styled-components';
import Loading from './../Loading';
import ErrorNotification from './../ErrorNotification';
import Title from './Title';
import Subtitle from './Subtitle';
import PageActions from './PageActions';
import ErrorBoundary from '../ErrorBoundary';
import React, { ReactNode } from "react";
import classNames from "classnames";
import styled from "styled-components";
import Loading from "./../Loading";
import ErrorNotification from "./../ErrorNotification";
import Title from "./Title";
import Subtitle from "./Subtitle";
import PageActions from "./PageActions";
import ErrorBoundary from "../ErrorBoundary";
type Props = {
title?: string;
@@ -14,7 +14,7 @@ type Props = {
loading?: boolean;
error?: Error;
showContentOnError?: boolean;
children: React.Node;
children: ReactNode;
};
const PageActionContainer = styled.div`
@@ -61,10 +61,10 @@ export default class Page extends React.Component<Props> {
pageActions = (
<PageActionContainer
className={classNames(
'column',
'is-three-fifths',
'is-mobile-action-spacing',
'is-flex',
"column",
"is-three-fifths",
"is-mobile-action-spacing",
"is-flex"
)}
>
{child}
@@ -102,7 +102,7 @@ export default class Page extends React.Component<Props> {
return <Loading />;
}
let content = [];
let content: ReactNode[] = [];
React.Children.forEach(children, child => {
if (child) {
if (!this.isPageAction(child)) {

View File

@@ -1,14 +1,14 @@
import * as React from 'react';
import Loading from './../Loading';
import React, { ReactNode } from "react";
import Loading from "./../Loading";
type Props = {
loading?: boolean;
error?: Error;
children: React.Node;
children: ReactNode;
};
export default class PageActions extends React.Component<Props> {
static displayName = 'PageActions';
static displayName = "PageActions";
render() {
return <>{this.renderContent()}</>;

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React from "react";
type Props = {
subtitle?: string;

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React from "react";
type Props = {
title?: string;

View File

@@ -1,9 +1,9 @@
// @create-index
export { default as Footer } from './Footer';
export { default as Header } from './Header';
export { default as Level } from './Level';
export { default as Page } from './Page';
export { default as PageActions } from './PageActions';
export { default as Subtitle } from './Subtitle';
export { default as Title } from './Title';
export { default as Footer } from "./Footer";
export { default as Header } from "./Header";
export { default as Level } from "./Level";
export { default as Page } from "./Page";
export { default as PageActions } from "./PageActions";
export { default as Subtitle } from "./Subtitle";
export { default as Title } from "./Title";