Converted /components/banner to typescript

This commit is contained in:
Nicola Thouliss 2021-06-02 19:06:45 +10:00
parent ecc4f67f37
commit c590adf836
4 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,3 @@
import React from "react";
import Modal from "react-modal";
import { useThemeUI, Close } from "theme-ui";
@ -8,6 +7,12 @@ function Banner({
children,
allowClose,
backgroundColor,
}: {
isOpen: boolean,
onRequestClose: any,
children: any,
allowClose: boolean,
backgroundColor?: any
}) {
const { theme } = useThemeUI();
@ -18,7 +23,7 @@ function Banner({
style={{
overlay: { bottom: "0", top: "initial", zIndex: 2000 },
content: {
backgroundColor: backgroundColor || theme.colors.highlight,
backgroundColor: backgroundColor || theme.colors?.highlight,
color: "hsl(210, 50%, 96%)",
top: "initial",
left: "50%",

View File

@ -1,9 +1,8 @@
import React from "react";
import { Box, Text } from "theme-ui";
import Banner from "./Banner";
function ErrorBanner({ error, onRequestClose }) {
function ErrorBanner({ error, onRequestClose }: { error: Error | undefined, onRequestClose: any }) {
return (
<Banner isOpen={!!error} onRequestClose={onRequestClose}>
<Box p={1}>

View File

@ -1,10 +1,9 @@
import React from "react";
import { Flex } from "theme-ui";
import Banner from "./Banner";
import OfflineIcon from "../../icons/OfflineIcon";
function OfflineBanner({ isOpen }) {
function OfflineBanner({ isOpen }: { isOpen: boolean }) {
return (
<Banner
isOpen={isOpen}

View File

@ -1,10 +1,9 @@
import React from "react";
import { Flex } from "theme-ui";
import Banner from "./Banner";
import ReconnectingIcon from "../../icons/ReconnectingIcon";
function ReconnectBanner({ isOpen }) {
function ReconnectBanner({ isOpen }: { isOpen: boolean }) {
return (
<Banner
isOpen={isOpen}