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

40 lines
1 KiB
React
Raw Normal View History

2021-07-21 17:33:28 +02:00
// @flow
2021-12-20 15:00:22 +01:00
import { LOGO_TITLE, LOGO, LOGO_WHITE_TEXT, LOGO_DARK_TEXT } from 'config';
import { useIsMobile } from 'effects/use-screensize';
2021-07-21 17:33:28 +02:00
import * as ICONS from 'constants/icons';
import Icon from 'component/common/icon';
2021-12-20 15:00:22 +01:00
import React from 'react';
2021-07-21 17:33:28 +02:00
type Props = {
currentTheme: string,
2021-12-20 15:00:22 +01:00
type: string,
2021-07-21 17:33:28 +02:00
};
export default function Logo(props: Props) {
2021-12-20 15:00:22 +01:00
const { currentTheme, type } = props;
2021-07-26 00:03:48 +02:00
const isMobile = useIsMobile();
2021-12-20 15:00:22 +01:00
const isLightTheme = currentTheme === 'light';
2021-07-26 00:03:48 +02:00
const defaultWithLabel = (
<>
<Icon icon={ICONS.LBRY} />
2021-12-20 15:00:22 +01:00
<div className="button__label">{LOGO_TITLE}</div>
2021-07-26 00:03:48 +02:00
</>
);
2021-12-20 15:00:22 +01:00
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} />;
2021-07-21 17:33:28 +02:00
}
2021-12-20 15:00:22 +01:00
if (LOGO_WHITE_TEXT && LOGO_DARK_TEXT) {
return <img className="header__navigation-logo" src={isLightTheme ? LOGO_DARK_TEXT : LOGO_WHITE_TEXT} />;
}
return defaultWithLabel;
2021-07-21 17:33:28 +02:00
}