plugins/home-page: use dev-utils to set up dev app

This commit is contained in:
Patrik Oldsberg
2020-04-26 14:22:58 +02:00
parent b81ebe7e72
commit e62bd2b431
2 changed files with 5 additions and 36 deletions
+4 -36
View File
@@ -14,41 +14,9 @@
* limitations under the License.
*/
import React, { FC } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import HomeIcon from '@material-ui/icons/Home';
import { ThemeProvider, CssBaseline } from '@material-ui/core';
import {
createApp,
SidebarPage,
Sidebar,
SidebarItem,
SidebarSpacer,
} from '@backstage/core';
import { lightTheme } from '@backstage/theme';
import { createDevApp } from '@backstage/dev-utils';
import { plugin } from '../src/plugin';
const app = createApp();
app.registerPlugin(plugin);
const AppComponent = app.build();
const App: FC<{}> = () => {
return (
<ThemeProvider theme={lightTheme}>
<CssBaseline>
<BrowserRouter>
<SidebarPage>
<Sidebar>
<SidebarSpacer />
<SidebarItem icon={HomeIcon} to="/home" text="Home" />
</Sidebar>
<AppComponent />
</SidebarPage>
</BrowserRouter>
</CssBaseline>
</ThemeProvider>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
createDevApp()
.registerPlugin(plugin)
.render();
+1
View File
@@ -14,6 +14,7 @@
},
"devDependencies": {
"@backstage/cli": "^0.1.1-alpha.4",
"@backstage/dev-utils": "^0.1.1-alpha.4",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",