Merge pull request #321 from LemmyNet/fix/symbols_issue

Fix/symbols issue
This commit is contained in:
Dessalines 2021-07-16 14:30:41 -04:00 committed by GitHub
commit b4bb672cc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 178 additions and 184 deletions

View file

@ -15,6 +15,7 @@ import IsomorphicCookie from "isomorphic-cookie";
import { GetSite, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
import process from "process";
import { Helmet } from "inferno-helmet";
import { SYMBOLS } from "../shared/components/symbols";
import { initializeSite } from "../shared/initialize";
import { httpBaseInternal } from "../shared/env";
import { IncomingHttpHeaders } from "http";
@ -99,6 +100,7 @@ server.get("/*", async (req, res) => {
);
const root = renderToString(wrapper);
const symbols = renderToString(SYMBOLS);
const cspStr = process.env.LEMMY_EXTERNAL_HOST ? renderToString(cspHtml) : "";
const helmet = Helmet.renderStatic();
@ -130,6 +132,10 @@ server.get("/*", async (req, res) => {
<!-- Current theme and more -->
${helmet.link.toString()}
<!-- Icons -->
${symbols}
</head>
<body ${helmet.bodyAttributes.toString()}>

View file

@ -8,7 +8,6 @@ import { Navbar } from "./navbar";
import { Footer } from "./footer";
import { NoMatch } from "./no-match";
import { Theme } from "./theme";
import { Symbols } from "./symbols";
import { GetSiteResponse } from "lemmy-js-client";
import "./styles.scss";
import { favIconPngUrl, favIconUrl } from "../utils";
@ -59,7 +58,6 @@ export class App extends Component<AppProps, any> {
))}
<Route render={props => <NoMatch {...props} />} />
</Switch>
<Symbols />
</div>
<Footer site={this.props.siteRes} />
</div>

View file

@ -13,10 +13,10 @@ export class Icon extends Component<IconProps, any> {
render() {
return (
<svg class={`icon ${this.props.classes}`}>
<use xlinkHref={`#icon-${this.props.icon}`}></use>
<div class="sr-only">
<title>{this.props.icon}</title>
</div>
<use xlinkHref={`#icon-${this.props.icon}`}></use>
</svg>
);
}

View file

@ -1,12 +1,4 @@
import { Component } from "inferno";
export class Symbols extends Component<any, any> {
constructor(props: any, context: any) {
super(props, context);
}
render() {
return (
export const SYMBOLS = (
<svg
aria-hidden="true"
style={{
@ -177,5 +169,3 @@ export class Symbols extends Component<any, any> {
</defs>
</svg>
);
}
}