Refactor Logo

This commit is contained in:
Rafael 2021-12-20 11:00:22 -03:00 committed by Thomas Zarebczan
parent 5c6fb9de66
commit 89d84e0776
3 changed files with 26 additions and 51 deletions

View file

@ -52,8 +52,8 @@ YRBL_HAPPY_IMG_URL=https://spee.ch/spaceman-happy:a.png?quality=85&height=457&wi
YRBL_SAD_IMG_URL=https://spee.ch/spaceman-sad:d.png?quality=85&height=457&width=457
LOGIN_IMG_URL=https://cdn.lbryplayer.xyz/speech/odysee-sign-up:d.png
LOGO=https://spee.ch/odysee-logo-png:3.png?quality=85&height=200&width=200
LOGO_TEXT_LIGHT=https://spee.ch/odysee-white-png:f.png?quality=85&height=300&width=1000
LOGO_TEXT_DARK=https://spee.ch/odysee-png:2.png?quality=85&height=300&width=1000
LOGO_WHITE_TEXT=https://spee.ch/odysee-white-png:f.png?quality=85&height=300&width=1000
LOGO_DARK_TEXT=https://spee.ch/odysee-png:2.png?quality=85&height=300&width=1000
AVATAR_DEFAULT=https://spee.ch/spaceman-png:2.png?quality=85&height=180&width=180
MISSING_THUMB_DEFAULT=https://spee.ch/missing-thumb-png?quality=85&height=390&width=220
FAVICON=https://spee.ch/favicon-png:c.png

View file

@ -35,8 +35,8 @@ const config = {
// LOGO
LOGO_TITLE: process.env.LOGO_TITLE,
LOGO: process.env.LOGO,
LOGO_TEXT_LIGHT: process.env.LOGO_TEXT_LIGHT,
LOGO_TEXT_DARK: process.env.LOGO_TEXT_DARK,
LOGO_WHITE_TEXT: process.env.LOGO_WHITE_TEXT,
LOGO_DARK_TEXT: process.env.LOGO_DARK_TEXT,
AVATAR_DEFAULT: process.env.AVATAR_DEFAULT,
MISSING_THUMB_DEFAULT: process.env.MISSING_THUMB_DEFAULT,
// OG

View file

@ -1,64 +1,39 @@
// @flow
import React from 'react';
import * as ICONS from 'constants/icons';
import { LOGO_TITLE, LOGO, LOGO_TEXT_LIGHT, LOGO_TEXT_DARK } from 'config';
import Icon from 'component/common/icon';
import { LOGO_TITLE, LOGO, LOGO_WHITE_TEXT, LOGO_DARK_TEXT } from 'config';
import { useIsMobile } from 'effects/use-screensize';
import * as ICONS from 'constants/icons';
import Icon from 'component/common/icon';
import React from 'react';
type Props = {
type: string,
currentTheme: string,
type: string,
};
export default function Logo(props: Props) {
const { type, currentTheme } = props;
const { currentTheme, type } = props;
const isMobile = useIsMobile();
const isLightTheme = currentTheme === 'light';
const defaultWithLabel = (
<>
<Icon icon={ICONS.LBRY} />
{/* @if TARGET='app' */}
<div className={'button__label'}>{'LBRY'}</div>
{/* @endif */}
{/* @if TARGET='web' */}
<div className={'button__label'}>{LOGO_TITLE}</div>
{/* @endif */}
<div className="button__label">{LOGO_TITLE}</div>
</>
);
if (type === 'small' || (isMobile && type !== 'embed')) {
return LOGO ? <img className={'header__navigation-logo'} src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
} else if (type === 'embed') {
if (LOGO_TEXT_LIGHT) {
return (
<>
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
</>
);
} else {
if (LOGO_WHITE_TEXT && (type === 'embed' || type === 'embed-ended')) {
return <img className="embed__overlay-logo" src={LOGO_WHITE_TEXT} />;
}
if (type === 'small' || isMobile) {
return <img className="header__navigation-logo" src={LOGO} />;
}
if (LOGO_WHITE_TEXT && LOGO_DARK_TEXT) {
return <img className="header__navigation-logo" src={isLightTheme ? LOGO_DARK_TEXT : LOGO_WHITE_TEXT} />;
}
return defaultWithLabel;
}
} else if (type === 'embed-ended') {
if (LOGO_TEXT_LIGHT) {
return (
<>
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
</>
);
} else {
return defaultWithLabel;
}
} else {
if (LOGO_TEXT_LIGHT && LOGO_TEXT_DARK) {
return (
<>
<img
className={'header__navigation-logo'}
src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT}
/>
</>
);
} else {
return defaultWithLabel;
}
}
}