use styled-components for scm-git-plugin instead of react-jss

This commit is contained in:
Sebastian Sdorra
2019-10-08 08:15:37 +02:00
parent 6e99182b4e
commit 03b10b8c5f
5 changed files with 113 additions and 27 deletions

View File

@@ -4,8 +4,8 @@ import * as React from "react";
import * as ReactDOM from "react-dom";
import * as ReactRouterDom from "react-router-dom";
import * as ReactRedux from "react-redux";
import {default as injectSheets } from "react-jss";
import * as ReactJSS from "react-jss";
import SytleComponentsDefault from "styled-components";
import * as SytleComponents from "styled-components";
import * as ReactI18Next from "react-i18next";
import * as ClassNames from "classnames";
import * as UIExtensions from "@scm-manager/ui-extensions";
@@ -30,14 +30,23 @@ SystemJS.config({
}
});
const expose = (name, cmp) => {
SystemJS.set(name, SystemJS.newModule(cmp));
const expose = (name, cmp, defaultCmp) => {
let mod = cmp;
if (defaultCmp) {
// SystemJS default export:
// https://github.com/systemjs/systemjs/issues/1749
mod = {
...cmp,
__useDefault: defaultCmp
};
}
SystemJS.set(name, SystemJS.newModule(mod));
};
expose("react", React);
expose("react-dom", ReactDOM);
expose("react-router-dom", ReactRouterDom);
expose("react-jss", {...ReactJSS, default: injectSheets});
expose("styled-components", SytleComponents, SytleComponentsDefault);
expose("react-redux", ReactRedux);
expose("react-i18next", ReactI18Next);
expose("classnames", ClassNames);