flow: Correctly type Theme

This commit is contained in:
Tom Moor
2020-11-09 00:01:50 -08:00
parent 26f4901547
commit 71e9860f88
10 changed files with 21 additions and 11 deletions

View File

@ -11,11 +11,12 @@ import Avatar from "components/Avatar";
import Flex from "components/Flex";
import Time from "components/Time";
import RevisionMenu from "menus/RevisionMenu";
import { type Theme } from "types";
import { documentHistoryUrl } from "utils/routeHelpers";
type Props = {
theme: Object,
theme: Theme,
showMenu: boolean,
selected: boolean,
document: Document,

View File

@ -7,11 +7,12 @@ import keydown from "react-keydown";
import { withRouter, type RouterHistory } from "react-router-dom";
import styled, { withTheme } from "styled-components";
import Input from "./Input";
import { type Theme } from "types";
import { searchUrl } from "utils/routeHelpers";
type Props = {
history: RouterHistory,
theme: Object,
theme: Theme,
source: string,
placeholder?: string,
collectionId?: string,

View File

@ -21,6 +21,7 @@ import { LoadingIndicatorBar } from "components/LoadingIndicator";
import Modal from "components/Modal";
import Sidebar from "components/Sidebar";
import SettingsSidebar from "components/Sidebar/Settings";
import { type Theme } from "types";
import {
homeUrl,
searchUrl,
@ -35,7 +36,7 @@ type Props = {
auth: AuthStore,
ui: UiStore,
notifications?: React.Node,
theme: Object,
theme: Theme,
};
@observer

View File

@ -5,6 +5,7 @@ import * as React from "react";
import { withRouter, NavLink } from "react-router-dom";
import styled, { withTheme } from "styled-components";
import Flex from "components/Flex";
import { type Theme } from "types";
type Props = {
to?: string | Object,
@ -19,7 +20,7 @@ type Props = {
hideDisclosure?: boolean,
iconColor?: string,
active?: boolean,
theme: Object,
theme: Theme,
exact?: boolean,
depth?: number,
};

View File

@ -2,9 +2,10 @@
import * as React from "react";
import { NavLink } from "react-router-dom";
import styled, { withTheme } from "styled-components";
import { type Theme } from "types";
type Props = {
theme: Object,
theme: Theme,
};
const StyledNavLink = styled(NavLink)`

View File

@ -36,6 +36,7 @@ import Tab from "components/Tab";
import Tabs from "components/Tabs";
import Tooltip from "components/Tooltip";
import CollectionMenu from "menus/CollectionMenu";
import { type Theme } from "types";
import { AuthorizationError } from "utils/errors";
import { newDocumentUrl, collectionUrl } from "utils/routeHelpers";
@ -45,7 +46,7 @@ type Props = {
collections: CollectionsStore,
policies: PoliciesStore,
match: Match,
theme: Object,
theme: Theme,
};
@observer

View File

@ -22,7 +22,7 @@ import DocumentComponent from "./Document";
import HideSidebar from "./HideSidebar";
import Loading from "./Loading";
import SocketPresence from "./SocketPresence";
import { type LocationWithState } from "types";
import { type LocationWithState, type Theme } from "types";
import { NotFoundError, OfflineError } from "utils/errors";
import isInternalUrl from "utils/isInternalUrl";
import { matchDocumentEdit, updateDocumentUrl } from "utils/routeHelpers";
@ -35,7 +35,7 @@ type Props = {|
policies: PoliciesStore,
revisions: RevisionsStore,
ui: UiStore,
theme: Object,
theme: Theme,
history: RouterHistory,
|};

View File

@ -30,7 +30,7 @@ import Header from "./Header";
import KeyboardShortcutsButton from "./KeyboardShortcutsButton";
import MarkAsViewed from "./MarkAsViewed";
import References from "./References";
import { type LocationWithState } from "types";
import { type LocationWithState, type Theme } from "types";
import { isCustomDomain } from "utils/domains";
import { emojiToUrl } from "utils/emoji";
import {
@ -62,7 +62,7 @@ type Props = {
readOnly: boolean,
onCreateLink: (title: string) => string,
onSearchLink: (term: string) => any,
theme: Object,
theme: Theme,
auth: AuthStore,
ui: UiStore,
};

View File

@ -3,11 +3,12 @@ import { SearchIcon } from "outline-icons";
import * as React from "react";
import styled, { withTheme } from "styled-components";
import Flex from "components/Flex";
import { type Theme } from "types";
type Props = {
onChange: (string) => void,
defaultValue?: string,
theme: Object,
theme: Theme,
};
class SearchField extends React.Component<Props> {

View File

@ -1,7 +1,10 @@
// @flow
import { type Location } from "react-router-dom";
import theme from "shared/styles/theme";
import Document from "models/Document";
export type Theme = typeof theme;
export type LocationWithState = Location & {
state: {
[key: string]: string,