Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hard-coded link in Header component changed by LMS_BASE_URL env var #186

Merged
merged 4 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ import { Hyperlink } from '@edx/paragon';
import { getConfig } from '@edx/frontend-platform';

export default class Header extends React.Component {

constructor(props){
super(props);
}

renderLogo() {
return (
<img src={getConfig().LOGO_URL} alt="edX logo" height="30" width="60" />
);
}

render() {
const {
logoDestination
} = this.props;
const logoProps = { destination: logoDestination}
return (
<div className="mb-3">
<header className="d-flex justify-content-center align-items-center p-3 border-bottom-blue">
<Hyperlink destination="https://www.edx.org">
<Hyperlink {...logoProps}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the variable declarations seem unnecessary, you could just have this be <Hyperlink destination={this.props.logoDestination}>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should just read:

<Hyperlink destination={`${getConfig().LMS_BASE_URL}/dashboard`}>

It's not really a configurable thing/there doesn't seem to be much value in passing it down from above.

{this.renderLogo()}
</Hyperlink>
<div />
Expand Down
4 changes: 3 additions & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ const App = () => (
<Provider store={store}>
<Router>
<div>
<Header />
<Header
logoDestination={getConfig().LMS_BASE_URL.concat('/dashboard')}
/>
<main>
<Switch>
<Route exact path={getConfig().PUBLIC_PATH.concat(':courseId')} component={GradebookPage} />
Expand Down