logoComponent

This commit is contained in:
zeppi 2021-07-21 11:33:28 -04:00 committed by jessopb
parent e4d7e4f69d
commit 19f8b0adac
4 changed files with 47 additions and 6 deletions

View file

@ -25,9 +25,10 @@ const config = {
// LOGO // LOGO
LOGO_TITLE: process.env.LOGO_TITLE, LOGO_TITLE: process.env.LOGO_TITLE,
FAVICON: process.env.FAVICON, FAVICON: process.env.FAVICON,
LOGO_URL: process.env.LOGO_URL, LOGO: process.env.LOGO,
LOGO_TEXT_LIGHT_URL: process.env.LOGO_TEXT_LIGHT_URL, LOGO_TEXT_LIGHT: process.env.LOGO_TEXT_LIGHT,
LOGO_TEXT_DARK_URL: process.env.LOGO_TEXT_DARK_URL, LOGO_TEXT_DARK: process.env.LOGO_TEXT_DARK,
AVATAR_DEFAULT: process.env.AVATAR_DEFAULT,
// OG // OG
OG_TITLE_SUFFIX: process.env.OG_TITLE_SUFFIX, OG_TITLE_SUFFIX: process.env.OG_TITLE_SUFFIX,
OG_HOMEPAGE_TITLE: process.env.OG_HOMEPAGE_TITLE, OG_HOMEPAGE_TITLE: process.env.OG_HOMEPAGE_TITLE,

View file

@ -15,6 +15,7 @@ import { useIsMobile } from 'effects/use-screensize';
import NotificationBubble from 'component/notificationBubble'; import NotificationBubble from 'component/notificationBubble';
import NotificationHeaderButton from 'component/notificationHeaderButton'; import NotificationHeaderButton from 'component/notificationHeaderButton';
import ChannelThumbnail from 'component/channelThumbnail'; import ChannelThumbnail from 'component/channelThumbnail';
import Logo from 'component/logo';
// @if TARGET='app' // @if TARGET='app'
import { remote } from 'electron'; import { remote } from 'electron';
import { IS_MAC } from 'component/app/view'; import { IS_MAC } from 'component/app/view';
@ -258,7 +259,6 @@ const Header = (props: Props) => {
// @if TARGET='web' // @if TARGET='web'
label={LOGO_TITLE} // eslint-disable-line label={LOGO_TITLE} // eslint-disable-line
// @endif // @endif
icon={ICONS.LBRY}
onClick={() => { onClick={() => {
if (history.location.pathname === '/') window.location.reload(); if (history.location.pathname === '/') window.location.reload();
}} }}
@ -268,8 +268,9 @@ const Header = (props: Props) => {
}} }}
// @endif // @endif
{...homeButtonNavigationProps} {...homeButtonNavigationProps}
/> >
<Logo />
</Button>
{!authHeader && ( {!authHeader && (
<div className="header__center"> <div className="header__center">
{/* @if TARGET='app' */} {/* @if TARGET='app' */}

View file

@ -0,0 +1,10 @@
import { connect } from 'react-redux';
import Logo from './view';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { SETTINGS } from 'lbry-redux';
const select = (state, props) => ({
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
});
export default connect(select)(Logo);

View file

@ -0,0 +1,29 @@
// @flow
import React from 'react';
import * as ICONS from 'constants/icons';
import { LOGO, LOGO_TEXT_LIGHT, LOGO_TEXT_DARK } from 'config';
import Icon from 'component/common/icon';
type Props = {
type: string,
currentTheme: string,
};
export default function Logo(props: Props) {
const { type, currentTheme } = props;
if (type === 'small') {
return LOGO ? <img src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
} else {
if (LOGO_TEXT_LIGHT && LOGO_TEXT_DARK) {
return (
<>
{/*<img src={LOGO} className="mobile-only header__odysee" />*/}
<img src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT} className="header__odysee" />
</>
);
} else {
return <Icon icon={ICONS.LBRY} />;
}
}
}
//mobile-hidden