mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-23 11:21:26 +00:00
Fix symbols issue. Fixes #319
This commit is contained in:
parent
40a14b5ebe
commit
1a4db014d7
4 changed files with 181 additions and 187 deletions
|
@ -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";
|
||||
|
@ -109,6 +110,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();
|
||||
|
||||
|
@ -140,6 +142,10 @@ server.get("/*", async (req, res) => {
|
|||
|
||||
<!-- Current theme and more -->
|
||||
${helmet.link.toString()}
|
||||
|
||||
<!-- Icons -->
|
||||
${symbols}
|
||||
|
||||
</head>
|
||||
|
||||
<body ${helmet.bodyAttributes.toString()}>
|
||||
|
@ -160,9 +166,9 @@ server.listen(Number(port), hostname, () => {
|
|||
console.log(`http://${hostname}:${port}`);
|
||||
});
|
||||
|
||||
function setForwardedHeaders(
|
||||
headers: IncomingHttpHeaders
|
||||
): { [key: string]: string } {
|
||||
function setForwardedHeaders(headers: IncomingHttpHeaders): {
|
||||
[key: string]: string;
|
||||
} {
|
||||
let out = {
|
||||
host: headers.host,
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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={{
|
||||
|
@ -176,6 +168,4 @@ export class Symbols extends Component<any, any> {
|
|||
</symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue