From a8429f3e1d148dbfcdc5e11d722fe217267a479c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 26 Apr 2021 09:49:21 +0100 Subject: [PATCH] Convert Vector skin react components to Typescript --- .../{VectorEmbeddedPage.js => VectorEmbeddedPage.tsx} | 2 +- .../auth/{VectorAuthFooter.js => VectorAuthFooter.tsx} | 0 .../{VectorAuthHeaderLogo.js => VectorAuthHeaderLogo.tsx} | 5 ----- .../views/auth/{VectorAuthPage.js => VectorAuthPage.tsx} | 8 ++++---- 4 files changed, 5 insertions(+), 10 deletions(-) rename src/components/structures/{VectorEmbeddedPage.js => VectorEmbeddedPage.tsx} (98%) rename src/components/views/auth/{VectorAuthFooter.js => VectorAuthFooter.tsx} (100%) rename src/components/views/auth/{VectorAuthHeaderLogo.js => VectorAuthHeaderLogo.tsx} (92%) rename src/components/views/auth/{VectorAuthPage.js => VectorAuthPage.tsx} (93%) diff --git a/src/components/structures/VectorEmbeddedPage.js b/src/components/structures/VectorEmbeddedPage.tsx similarity index 98% rename from src/components/structures/VectorEmbeddedPage.js rename to src/components/structures/VectorEmbeddedPage.tsx index 2397eef144..85adb2fb3f 100644 --- a/src/components/structures/VectorEmbeddedPage.js +++ b/src/components/structures/VectorEmbeddedPage.tsx @@ -24,7 +24,7 @@ export default class VectorEmbeddedPage extends EmbeddedPage { static replaces = 'EmbeddedPage'; // we're overriding the base component here, for Element-specific tweaks - translate(s) { + translate(s: string) { s = sanitizeHtml(_t(s)); // ugly fix for https://github.com/vector-im/element-web/issues/4243 // eslint-disable-next-line max-len diff --git a/src/components/views/auth/VectorAuthFooter.js b/src/components/views/auth/VectorAuthFooter.tsx similarity index 100% rename from src/components/views/auth/VectorAuthFooter.js rename to src/components/views/auth/VectorAuthFooter.tsx diff --git a/src/components/views/auth/VectorAuthHeaderLogo.js b/src/components/views/auth/VectorAuthHeaderLogo.tsx similarity index 92% rename from src/components/views/auth/VectorAuthHeaderLogo.js rename to src/components/views/auth/VectorAuthHeaderLogo.tsx index 73f952e525..d3bf32341b 100644 --- a/src/components/views/auth/VectorAuthHeaderLogo.js +++ b/src/components/views/auth/VectorAuthHeaderLogo.tsx @@ -16,16 +16,11 @@ limitations under the License. */ import React from 'react'; -import PropTypes from 'prop-types'; import SdkConfig from 'matrix-react-sdk/src/SdkConfig'; export default class VectorAuthHeaderLogo extends React.PureComponent { static replaces = 'AuthHeaderLogo' - static propTypes = { - icon: PropTypes.string, - } - render() { const brandingConfig = SdkConfig.get().branding; let logoUrl = "themes/element/img/logos/element-logo.svg"; diff --git a/src/components/views/auth/VectorAuthPage.js b/src/components/views/auth/VectorAuthPage.tsx similarity index 93% rename from src/components/views/auth/VectorAuthPage.js rename to src/components/views/auth/VectorAuthPage.tsx index 19fd618073..b50c401f99 100644 --- a/src/components/views/auth/VectorAuthPage.js +++ b/src/components/views/auth/VectorAuthPage.tsx @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React from 'react'; +import React, { CSSProperties } from 'react'; import * as sdk from 'matrix-react-sdk/src/index'; import SdkConfig from 'matrix-react-sdk/src/SdkConfig'; @@ -48,12 +48,12 @@ export default class VectorAuthPage extends React.PureComponent { background: `center/cover fixed url(${VectorAuthPage.getWelcomeBackgroundUrl()})`, }; - const modalStyle = { + const modalStyle: CSSProperties = { position: 'relative', background: 'initial', }; - const blurStyle = { + const blurStyle: CSSProperties = { position: 'absolute', top: 0, right: 0, @@ -63,7 +63,7 @@ export default class VectorAuthPage extends React.PureComponent { background: pageStyle.background, }; - const modalContentStyle = { + const modalContentStyle: CSSProperties = { display: 'flex', zIndex: 1, background: 'rgba(255, 255, 255, 0.59)',