Step 10.3: Use module replacement to achieve component overrides

This is the same system as the customisations override, however deliberately using a different JSON file to avoid conflicts. 

Forks would be expected to use the customisations file, not the components file, to override/add components.
This commit is contained in:
Travis Ralston 2022-03-24 23:41:19 -06:00
parent 5459c1eb96
commit 5b592eca4f
5 changed files with 27 additions and 18 deletions

View file

@ -44,6 +44,4 @@ const VectorAuthFooter = () => {
);
};
VectorAuthFooter.replaces = 'AuthFooter';
export default VectorAuthFooter;

View file

@ -19,9 +19,7 @@ import React from 'react';
import SdkConfig from 'matrix-react-sdk/src/SdkConfig';
export default class VectorAuthHeaderLogo extends React.PureComponent {
static replaces = 'AuthHeaderLogo';
render() {
public render() {
const brandingConfig = SdkConfig.getObject("branding");
const logoUrl = brandingConfig?.get("auth_header_logo_url") ?? "themes/element/img/logos/element-logo.svg";

View file

@ -20,12 +20,10 @@ import SdkConfig from 'matrix-react-sdk/src/SdkConfig';
import VectorAuthFooter from "./VectorAuthFooter";
export default class VectorAuthPage extends React.PureComponent {
static replaces = 'AuthPage';
static welcomeBackgroundUrl;
private static welcomeBackgroundUrl;
// cache the url as a static to prevent it changing without refreshing
static getWelcomeBackgroundUrl() {
private static getWelcomeBackgroundUrl() {
if (VectorAuthPage.welcomeBackgroundUrl) return VectorAuthPage.welcomeBackgroundUrl;
const brandingConfig = SdkConfig.getObject("branding");
@ -44,7 +42,7 @@ export default class VectorAuthPage extends React.PureComponent {
return VectorAuthPage.welcomeBackgroundUrl;
}
render() {
public render() {
const pageStyle = {
background: `center/cover fixed url(${VectorAuthPage.getWelcomeBackgroundUrl()})`,
};