Files
ThreadNet-Web/modules/banner/element-web/src/Logo.tsx
T

40 lines
864 B
TypeScript
Raw Normal View History

2025-05-08 12:06:05 +01:00
/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { type FC } from "react";
import styled from "styled-components";
import { type Api } from "@element-hq/element-web-module-api";
const Anchor = styled.a`
display: flex;
`;
const Image = styled.img`
2025-05-08 12:43:50 +01:00
height: ${({ theme }): string => theme.navbar.logoHeight};
2025-05-08 12:06:05 +01:00
align-self: center;
`;
interface Props {
api: Api;
src: string;
href?: string;
}
const Logo: FC<Props> = ({ api, src, href }) => {
2025-05-14 11:56:58 +01:00
const img = <Image alt={api.i18n.translate("logo_alt")} src={src} />;
2025-05-08 12:06:05 +01:00
if (!href) return img;
return (
2025-05-14 11:56:58 +01:00
<Anchor aria-label={api.i18n.translate("logo_link_label")} href={href}>
2025-05-08 12:06:05 +01:00
{img}
</Anchor>
);
};
export default Logo;