Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
fix(Icon): Inject icon css on mount to fix SSR builds
Browse files Browse the repository at this point in the history
  • Loading branch information
kylealwyn committed Sep 18, 2018
1 parent 6759aac commit 6398e43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Icon/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ class Icon extends React.Component {
static iconUrl = 'https://cdn.heydoctor.co/assets/css/material-design-icons.css';
static iconPrefix = 'mdi';

constructor(props) {
componentDidMount(props) {
super(props);

if (!this.constructor.injected) {
this.constructor.injected = true;
const link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = this.constructor.iconUrl;
document.head.appendChild(link);
this.constructor.injected = true;
}
}

Expand Down

0 comments on commit 6398e43

Please sign in to comment.