From c7ff216a19f8f8db4d1078729fd90078a121f83f Mon Sep 17 00:00:00 2001 From: Beatrix <68532117+abeatrix@users.noreply.github.com> Date: Tue, 14 Dec 2021 08:23:49 -0800 Subject: [PATCH] Add dismiss button to announcements (#28963) --- .../web/src/search/home/LoggedOutHomepage.tsx | 205 ++++++++---------- .../VulnerabilityAnnouncement.module.scss | 12 + .../search/home/VulnerabilityAnnouncement.tsx | 58 +++-- .../settings/temporary/TemporarySettings.ts | 1 + 4 files changed, 137 insertions(+), 139 deletions(-) diff --git a/client/web/src/search/home/LoggedOutHomepage.tsx b/client/web/src/search/home/LoggedOutHomepage.tsx index fb403907b63..84a6661d293 100644 --- a/client/web/src/search/home/LoggedOutHomepage.tsx +++ b/client/web/src/search/home/LoggedOutHomepage.tsx @@ -5,7 +5,6 @@ import React, { useCallback } from 'react' import { Link } from '@sourcegraph/shared/src/components/Link' import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService' import { ThemeProps } from '@sourcegraph/shared/src/theme' -import { Badge } from '@sourcegraph/wildcard' import { communitySearchContextsList } from '../../communitySearchContexts/HomepageConfig' import { SyntaxHighlightedSearchQuery } from '../../components/SyntaxHighlightedSearchQuery' @@ -72,127 +71,93 @@ const SearchExamples: React.FunctionComponent = ({ ) } -export const LoggedOutHomepage: React.FunctionComponent = props => { - const onSignUpClick = useCallback(() => { - props.telemetryService.log('HomepageCTAClicked', { campaign: 'Sign up link' }, { campaign: 'Sign up link' }) - }, [props.telemetryService]) - - return ( - -
- -
- {props.featureFlags.get('search-notebook-onboarding') ? ( - } - {...props} - /> - ) : ( - } - {...props} - /> - )} -
-
Watch and learn
- - props.telemetryService.log( - isOpen ? 'HomepageVideoWaysToSearchClicked' : 'HomepageVideoClosed' - ) - } - /> -
-
- -
-
-
- - Beta - -
- - Search your public and private code.{' '} - - Sign up - {' '} - to get started, or{' '} - - read our blog post - {' '} - to learn more. - -
-
- -
- -
- -
-
-
Search open source communities
-
- Customized search portals for our open source partners -
-
-
- {communitySearchContextsList.map(communitySearchContext => ( -
- {`${communitySearchContext.spec} - - {communitySearchContext.title} - -
- ))} -
-
- -
- -
- -
- +export const LoggedOutHomepage: React.FunctionComponent = props => ( + +
+ +
+ {props.featureFlags.get('search-notebook-onboarding') ? ( + } + {...props} + /> + ) : ( + } + {...props} + /> + )} +
+
Watch and learn
+ + props.telemetryService.log( + isOpen ? 'HomepageVideoWaysToSearchClicked' : 'HomepageVideoClosed' + ) + } + />
- - ) -} + +
+ +
+ +
+
+
Search open source communities
+
+ Customized search portals for our open source partners +
+
+
+ {communitySearchContextsList.map(communitySearchContext => ( +
+ {`${communitySearchContext.spec} + + {communitySearchContext.title} + +
+ ))} +
+
+ +
+ +
+ +
+ +
+
+
+) const MagnifyingGlassSearchIcon = React.memo(() => ( diff --git a/client/web/src/search/home/VulnerabilityAnnouncement.module.scss b/client/web/src/search/home/VulnerabilityAnnouncement.module.scss index 260590cd645..25b3accb304 100644 --- a/client/web/src/search/home/VulnerabilityAnnouncement.module.scss +++ b/client/web/src/search/home/VulnerabilityAnnouncement.module.scss @@ -6,4 +6,16 @@ padding: 0.75rem 1rem; margin-bottom: 1.75rem; background-image: var(--vulnerability-announcement); + + a { + color: var(--white); + + &:hover { + text-decoration: none; + } + } +} + +.close-button { + color: var(--white); } diff --git a/client/web/src/search/home/VulnerabilityAnnouncement.tsx b/client/web/src/search/home/VulnerabilityAnnouncement.tsx index 38bc8f7a2c4..2315bafb53c 100644 --- a/client/web/src/search/home/VulnerabilityAnnouncement.tsx +++ b/client/web/src/search/home/VulnerabilityAnnouncement.tsx @@ -1,29 +1,49 @@ import classNames from 'classnames' -import * as React from 'react' +import CloseIcon from 'mdi-react/CloseIcon' +import React from 'react' import { Badge } from '@sourcegraph/wildcard' +import { useTemporarySetting } from '../../settings/temporary/useTemporarySetting' + import styles from './VulnerabilityAnnouncement.module.scss' /** - * TODO description + * Displays a dismissible banner linking to the log4j blog post */ -export const VulnerabilityAnnouncement: React.FunctionComponent = () => ( -
- -
- + ) +} diff --git a/client/web/src/settings/temporary/TemporarySettings.ts b/client/web/src/settings/temporary/TemporarySettings.ts index 3d29b153112..060fcd57ec2 100644 --- a/client/web/src/settings/temporary/TemporarySettings.ts +++ b/client/web/src/settings/temporary/TemporarySettings.ts @@ -19,6 +19,7 @@ export interface TemporarySettingsSchema { 'user.daysActiveCount': number 'signup.finishedWelcomeFlow': boolean 'codemonitor.info.visible': boolean + 'dotcom.log4jVulnerabilityAnnouncement.visible': boolean } /**