Modernize build and fix the anonymous header (#26)
* refactor: rename SiteHeader to Header * build: use frontend-build * fix: ensure that we can handle anonymous users * feat: anonymous header works now Up until now we haven’t had any microfrontends that allowed anonymous usage. The Header was encountering errors rendering in such situations, though it was close. Now it properly shows the Login and Sign Up buttons. * build: bump version of frontend-build
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
const path = require('path');
|
||||
|
||||
// Resolve ~tilda paths used in paragon to
|
||||
// node_modules. This is used to reference
|
||||
// bootstrap specifically.
|
||||
module.exports = {
|
||||
includePaths: [
|
||||
path.resolve(__dirname, '../node_modules'),
|
||||
],
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<title>Example</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,36 +5,31 @@ import ReactDOM from 'react-dom';
|
||||
import { App, AppContext, APP_READY, AppProvider } from '@edx/frontend-base';
|
||||
import { NewRelicLoggingService } from '@edx/frontend-logging';
|
||||
import './index.scss';
|
||||
import SiteHeader from '../src/';
|
||||
import Header from '../src/';
|
||||
|
||||
App.subscribe(APP_READY, () => {
|
||||
ReactDOM.render(
|
||||
<AppProvider>
|
||||
{/* We can fake out authentication by including another provider here with the data we want */}
|
||||
<AppContext.Provider value={{
|
||||
authenticatedUser: {
|
||||
userId: null,
|
||||
username: null,
|
||||
roles: [],
|
||||
administrator: false,
|
||||
},
|
||||
authenticatedUser: null,
|
||||
config: App.config
|
||||
}}>
|
||||
<SiteHeader />
|
||||
<Header />
|
||||
</AppContext.Provider>
|
||||
<h5 className="mt-2 mb-5">Logged out state</h5>
|
||||
|
||||
{/* We can fake out authentication by including another provider here with the data we want */}
|
||||
<AppContext.Provider value={{
|
||||
authenticatedUser: {
|
||||
userId: null,
|
||||
userId: '123abc',
|
||||
username: 'testuser',
|
||||
roles: [],
|
||||
administrator: false,
|
||||
},
|
||||
config: App.config
|
||||
}}>
|
||||
<SiteHeader />
|
||||
<Header />
|
||||
</AppContext.Provider>
|
||||
<h5 className="mt-2">Logged in state</h5>
|
||||
</AppProvider>,
|
||||
@@ -42,4 +37,6 @@ App.subscribe(APP_READY, () => {
|
||||
);
|
||||
});
|
||||
|
||||
App.initialize({ messages: [], loggingService: NewRelicLoggingService });
|
||||
App.initialize({
|
||||
messages: []
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user