lbry-desktop/ui/component/logo/view.jsx

65 lines
1.6 KiB
React
Raw Permalink Normal View History

2021-07-21 17:33:28 +02:00
// @flow
import React from 'react';
import * as ICONS from 'constants/icons';
2021-07-26 00:03:48 +02:00
import { LOGO_TITLE, LOGO, LOGO_TEXT_LIGHT, LOGO_TEXT_DARK } from 'config';
2021-07-21 17:33:28 +02:00
import Icon from 'component/common/icon';
2021-07-26 00:03:48 +02:00
import { useIsMobile } from 'effects/use-screensize';
2021-07-21 17:33:28 +02:00
type Props = {
type: string,
currentTheme: string,
};
export default function Logo(props: Props) {
const { type, currentTheme } = props;
2021-07-26 00:03:48 +02:00
const isMobile = useIsMobile();
const defaultWithLabel = (
<>
<Icon icon={ICONS.LBRY} />
2021-07-26 14:41:10 +02:00
{/* @if TARGET='app' */}
<div className={'button__label'}>{'LBRY'}</div>
{/* @endif */}
{/* @if TARGET='web' */}
2021-07-26 00:40:53 +02:00
<div className={'button__label'}>{LOGO_TITLE}</div>
2021-07-26 14:41:10 +02:00
{/* @endif */}
2021-07-26 00:03:48 +02:00
</>
);
if (type === 'small' || (isMobile && type !== 'embed')) {
2021-07-30 18:07:32 +02:00
return LOGO ? <img className={'header__navigation-logo'} src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
2021-07-26 00:03:48 +02:00
} else if (type === 'embed') {
if (LOGO_TEXT_LIGHT) {
return (
<>
2021-08-03 19:32:28 +02:00
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
2021-08-03 19:23:52 +02:00
</>
);
} else {
return defaultWithLabel;
}
} else if (type === 'embed-ended') {
if (LOGO_TEXT_LIGHT) {
return (
<>
2021-08-03 19:32:28 +02:00
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
2021-07-26 00:03:48 +02:00
</>
);
} else {
return defaultWithLabel;
}
2021-07-21 17:33:28 +02:00
} else {
if (LOGO_TEXT_LIGHT && LOGO_TEXT_DARK) {
return (
<>
2021-07-30 18:07:32 +02:00
<img
className={'header__navigation-logo'}
src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT}
/>
2021-07-21 17:33:28 +02:00
</>
);
} else {
2021-07-26 00:03:48 +02:00
return defaultWithLabel;
2021-07-21 17:33:28 +02:00
}
}
}