+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-import * as React from 'react';
-import Link from '../../../../components/common/Link';
-import { translate } from '../../../../helpers/l10n';
-import { getBaseUrl } from '../../../../helpers/system';
-import { AppState } from '../../../../types/appstate';
-import { GlobalSettingKeys } from '../../../../types/settings';
-import withAppStateContext from '../../app-state/withAppStateContext';
-
-export interface GlobalNavBrandingProps {
- appState: AppState;
-}
-
-export function GlobalNavBranding({ appState: { settings } }: GlobalNavBrandingProps) {
- const customLogoUrl = settings[GlobalSettingKeys.LogoUrl];
- const customLogoWidth = settings[GlobalSettingKeys.LogoWidth];
-
- const title = translate('layout.nav.home_logo_alt');
- const url = customLogoUrl || `${getBaseUrl()}/images/logo.svg?v=6.6`;
- const width = customLogoUrl ? customLogoWidth || 100 : 83;
-
- return (
- <Link className="navbar-brand" to="/">
- <img alt={title} height={30} src={url} title={title} width={width} />
- </Link>
- );
-}
-
-export default withAppStateContext(GlobalNavBranding);
import { GlobalSettingKeys } from '../../../../types/settings';
import { AppStateContext } from '../../app-state/AppStateContext';
+const DEFAULT_CUSTOM_LOGO_WIDTH_IN_PX = 100;
+
function LogoWithAriaText() {
const { settings } = React.useContext(AppStateContext);
const customLogoUrl = settings[GlobalSettingKeys.LogoUrl];
+ const customLogoWidth = settings[GlobalSettingKeys.LogoWidth] ?? DEFAULT_CUSTOM_LOGO_WIDTH_IN_PX;
const title = translate('layout.nav.home_logo_alt');
return (
<div aria-label={title} role="img">
- {customLogoUrl ? <img alt={title} src={customLogoUrl} /> : <SonarQubeLogo />}
+ {customLogoUrl ? (
+ <img alt={title} src={customLogoUrl} width={customLogoWidth} />
+ ) : (
+ <SonarQubeLogo />
+ )}
</div>
);
}
{
key: 'sonar.lf.logoWidthPx',
name: 'Width of image in pixels',
- description: 'Width in pixels, given that the height of the the image is constrained to 30px.',
+ description:
+ 'Width in pixels, constrained to 150px (the height of the image is constrained to 40px).',
category: 'general',
subCategory: 'looknfeel',
options: [],
PropertyDefinition.builder(WebConstants.SONAR_LF_LOGO_WIDTH_PX)
.deprecatedKey("sonar.branding.image.width")
.name("Width of image in pixels")
- .description("Width in pixels, given that the height of the the image is constrained to 30px.")
+ .description("Width in pixels, constrained to 150px (the height of the image is constrained to 40px).")
.category(CoreProperties.CATEGORY_GENERAL)
.subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
.build(),