export class InteractiveIconBase extends React.PureComponent<InteractiveIconProps> {
handleClick = (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
const { disabled, onClick, stopPropagation = true } = this.props;
- event.currentTarget.blur();
if (stopPropagation) {
event.stopPropagation();
${tw`sw-flex`};
${tw`sw-items-center`};
${tw`sw-left-0`};
- ${tw`sw-px-6`};
${tw`sw-right-0`};
+ ${tw`sw-px-6`};
${tw`sw-w-full`};
${tw`sw-box-border`};
${tw`sw-z-global-navbar`};
--- /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 styled from '@emotion/styled';
+import { DetailedHTMLProps, HTMLAttributes, PropsWithChildren } from 'react';
+import tw from 'twin.macro';
+import { LAYOUT_GLOBAL_NAV_HEIGHT } from '../helpers';
+import { themeColor, themeContrast } from '../helpers/theme';
+
+interface Props {
+ id?: string;
+}
+
+export function TopBar({
+ children,
+ ...props
+}: PropsWithChildren<Props> & DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>) {
+ return (
+ <BaseStyle style={{ top: LAYOUT_GLOBAL_NAV_HEIGHT }} {...props}>
+ {children}
+ </BaseStyle>
+ );
+}
+
+const BaseStyle = styled.nav`
+ ${tw`sw-sticky`}
+ ${tw`sw-z-top-navbar`}
+ ${tw`sw-px-6 sw-pt-4`}
+ ${tw`sw-font-sans`}
+ ${tw`sw-text-sm`}
+
+ background-color: ${themeColor('backgroundPrimary')};
+ color: ${themeContrast('backgroundPrimary')};
+`;
): React.ComponentType<IconProps> {
function IconWrapper({ fill, ...props }: IconProps) {
const theme = useTheme();
+
return (
<WrappedOcticon
fill={fill && themeColor(fill)({ theme })}
export * from './SonarQubeLogo';
export * from './Text';
export { default as Tooltip } from './Tooltip';
+export { TopBar } from './TopBar';
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import classNames from 'classnames';
+import { TopBar } from 'design-system';
import * as React from 'react';
-import ContextNavBar from '../../../../components/ui/ContextNavBar';
import { translate } from '../../../../helpers/l10n';
import {
ProjectAlmBindingConfigurationErrors,
}
return (
- <ContextNavBar
- height={contextNavHeight}
- id="context-navigation"
- label={translate('qualifier', component.qualifier)}
- notif={<>{prDecoNotifComponent}</>}
- >
- <div
- className={classNames('display-flex-center display-flex-space-between', {
- 'padded-bottom little-padded-top': warnings.length === 0,
- 'little-padded-bottom': warnings.length > 0,
- })}
- >
+ <TopBar id="context-navigation" aria-label={translate('qualifier', component.qualifier)}>
+ <div className="sw-flex sw-justify-between">
<Header
branchLikes={branchLikes}
component={component}
/>
<InfoDrawer
displayed={displayProjectInfo}
- onClose={() => setDisplayProjectInfo(false)}
+ onClose={() => {
+ setDisplayProjectInfo(false);
+ }}
top={globalNavHeightRaw + contextNavHeight}
>
<ProjectInformation
onComponentChange={props.onComponentChange}
/>
</InfoDrawer>
- </ContextNavBar>
+ {prDecoNotifComponent}
+ </TopBar>
);
}
</span>
)}
{isLoggedIn(currentUser) && currentPage !== undefined && !isPullRequest(branchLike) && (
- <HomePageSelect className="sw-ml-4" currentPage={currentPage} />
+ <HomePageSelect className="sw-ml-2" currentPage={currentPage} />
)}
</div>
);
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import classNames from 'classnames';
-import { BareButton, HomeFillIcon, HomeIcon, Tooltip } from 'design-system';
+import { DiscreetInteractiveIcon, HomeFillIcon, HomeIcon, Tooltip } from 'design-system';
import * as React from 'react';
import { setHomePage } from '../../api/users';
import { CurrentUserContextInterface } from '../../app/components/current-user/CurrentUserContext';
{isDefault ? (
<span
aria-label={tooltip}
- className={classNames('display-inline-block', className)}
+ className={classNames('sw-inline-block', className)}
role="img"
>
<HomeFillIcon />
</span>
) : (
- <BareButton
+ <DiscreetInteractiveIcon
aria-label={tooltip}
className={className}
+ Icon={isChecked ? HomeFillIcon : HomeIcon}
onClick={isChecked ? this.handleReset : this.handleClick}
- >
- {isChecked ? <HomeFillIcon /> : <HomeIcon />}
- </BareButton>
+ />
)}
</Tooltip>
);