Skip to content

Commit 43034fb

Browse files
committed
Move favicon and logo logic out into options.
1 parent 723b7a4 commit 43034fb

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

options.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ const options = {
7777

7878
getSearchPlaceholder: (i18n) => i18n.gettext("Sample: christ or cristo"),
7979

80+
faviconUrl: "/images/favicon.png",
81+
logoUrl: "/images/lighthouse.sm.png",
82+
8083
recordTitle(record, i18n) {
8184
const parts = [];
8285

views/Page.jsx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ const Page = React.createClass({
2626
title: React.PropTypes.string,
2727
},
2828

29+
renderFavicon() {
30+
if (!options.faviconUrl) {
31+
return null;
32+
}
33+
34+
return <link rel="icon" type="image/x-icon"
35+
href={URL(options.faviconUrl)}
36+
/>;
37+
},
38+
2939
renderHead() {
3040
const URL = this.props.URL;
3141
let title = this.props.getTitle(options);
@@ -45,9 +55,7 @@ const Page = React.createClass({
4555
content="width=device-width, initial-scale=1.0"
4656
/>
4757
{noIndex && <meta name="robots" content="noindex"/>}
48-
<link rel="icon" type="image/x-icon"
49-
href={URL("/images/favicon.png")}
50-
/>
58+
{this.renderFavicon()}
5159
<title>{title}</title>
5260
{this.props.social && this.renderSocialMeta()}
5361
<link rel="stylesheet" href={URL("/css/bootstrap.min.css")}/>
@@ -75,6 +83,20 @@ const Page = React.createClass({
7583
];
7684
},
7785

86+
renderLogo() {
87+
if (!options.logoUrl) {
88+
return null;
89+
}
90+
91+
return <span>
92+
<img alt={this.props.getTitle(options)}
93+
src={URL(options.logoUrl)}
94+
height="40" width="40"
95+
/>
96+
{" "}
97+
</span>;
98+
},
99+
78100
renderHeader() {
79101
const gettext = this.props.gettext;
80102
const URL = this.props.URL;
@@ -92,11 +114,7 @@ const Page = React.createClass({
92114
<span className="icon-bar"></span>
93115
</button>
94116
<a className="navbar-brand" href={URL("/")}>
95-
<img alt={this.props.getTitle(options)}
96-
src={URL("/images/lighthouse.sm.png")}
97-
height="40" width="40"
98-
/>
99-
{" "}
117+
{this.renderLogo()}
100118
{this.props.getShortTitle(options)}
101119
</a>
102120
</div>

views/Search.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ const Search = React.createClass({
3636
})
3737
),
3838
format: React.PropTypes.func.isRequired,
39-
getDate: React.PropTypes.func.isRequired,
4039
getTitle: React.PropTypes.func.isRequired,
41-
getUnit: React.PropTypes.func.isRequired,
4240
gettext: React.PropTypes.func.isRequired,
4341
lang: React.PropTypes.string.isRequired,
4442
maxDate: React.PropTypes.string.isRequired,

0 commit comments

Comments
 (0)