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

47 lines
1.2 KiB
React
Raw 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 = (
<>
<label>{LOGO_TITLE}</label>
<Icon icon={ICONS.LBRY} />
</>
);
if (type === 'small' || (isMobile && type !== 'embed')) {
return LOGO ? <img className="header__odysee" src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
} else if (type === 'embed') {
if (LOGO_TEXT_LIGHT) {
return (
<>
<img src={LOGO_TEXT_LIGHT} className="header__odysee" />
</>
);
} else {
return defaultWithLabel;
}
2021-07-21 17:33:28 +02:00
} else {
if (LOGO_TEXT_LIGHT && LOGO_TEXT_DARK) {
return (
<>
<img src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT} className="header__odysee" />
</>
);
} else {
2021-07-26 00:03:48 +02:00
return defaultWithLabel;
2021-07-21 17:33:28 +02:00
}
}
}