import React from 'react';
import styled from 'styled-components';
import type { JSX } from 'react';
import type { LogoConfig } from '@redocly/theme/core/types';
import { useThemeHooks } from '@redocly/theme/core/hooks';
import { Link } from '@redocly/theme/components/Link/Link';
import { Image } from '@redocly/theme/components/Image/Image';
export type LogoProps = {
config: LogoConfig;
className?: string;
};
export function Logo({ config, className, ...otherProps }: LogoProps): JSX.Element | null {
const { useTelemetry } = useThemeHooks();
const telemetry = useTelemetry();
if (!config?.image && !config?.srcSet) {
return null;
}
const image = (
);
return (
{config.link ? (
telemetry.sendLogoClickedMessage()}>
{image}
) : (
image
)}
);
}
const LogoWrapper = styled.div`
max-width: var(--logo-max-width);
max-height: var(--logo-max-height);
height: var(--logo-height);
margin: var(--logo-margin);
img {
max-width: 100%;
max-height: 100%;
height: 100%;
}
`;