From 45cbd2b74385227f2f857aa92f16f4f838634466 Mon Sep 17 00:00:00 2001 From: Angela Chuang <6295984+angorayc@users.noreply.github.com> Date: Wed, 6 Dec 2023 16:26:25 +0000 Subject: [PATCH] [SecuritySolution] Get Started page UI (#172616) ## Summary Fix up for https://github.com/elastic/kibana/pull/171078 Test Env: https://p.elstc.co/paste/vmb8YG18#nCnDFTVE4HZxFK9M4TyHii3Gt4rq0YV25LQK33PqNly Screenshot 2023-12-05 at 19 00 06 **- Add footer section:** https://www.figma.com/file/07wil4wWtUy90m4NTBxZxG/Updated-Security-GSH-Flows%3A?node-id=1574%3A161997&mode=dev Screenshot 2023-12-05 at 18 42 36 **- Expand / Collapse task fix up:** 1. When no data integrated, clicking on `Add integrations step`from the callout should expand the step. 2. When visiting get started page with hash, it should expand the target step: e.g.: `/app/security/get_started#add_integrations` 3. All tasks should be collapsable. https://github.com/elastic/kibana/assets/6295984/91f8fe94-1c9d-48ef-be74-6f65bb63dfbd **- Designer review:** 1. Background color for task icons: ```Task not completed``` Background-grey on all states: Default, Hover, Expanded ```Task completed``` Background-green on all states: Default, Hover, Expanded ![image (5)](https://github.com/elastic/kibana/assets/6295984/d45c4ef3-15b9-454a-8b20-4d271e624d74) 5. Remove shadow on create project image: ![image (4)](https://github.com/elastic/kibana/assets/6295984/a57b4de1-9d58-4983-9d53-1cb13b61e66e) 6. Change the gab between task to 16px: ![image (3)](https://github.com/elastic/kibana/assets/6295984/0704401f-b931-40c4-8720-110ed77dab72) 7. Apply **bold** to completed task counts: ![image (2)](https://github.com/elastic/kibana/assets/6295984/44611911-f482-447a-b525-66698f5ca2f2) 8. Update badge padding: ![image (1)](https://github.com/elastic/kibana/assets/6295984/44c0e854-7938-43fb-adb6-d75f8e51c1a2) ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../content/__mocks__/content_wrapper.tsx | 10 ++ .../content/add_integration_image.tsx | 26 +++++ .../card_step/content/content_wrapper.tsx | 25 +++++ .../content/create_project_step_image.tsx | 19 ++++ .../card_step/content/enable_rule_image.tsx | 19 ++++ .../overview_video_description.tsx | 2 +- .../card_step/content/video.test.tsx | 81 +++++++++++++++ .../get_started/card_step/content/video.tsx | 83 +++++++++++++++ .../card_step/content/view_alerts_image.tsx | 19 ++++ .../content/view_dashboard_image.tsx | 24 +++++ .../get_started/card_step/helpers.test.ts | 57 ++++++++++ .../public/get_started/card_step/helpers.ts | 49 +++++++++ .../public/get_started/card_step/index.tsx | 9 +- .../get_started/card_step/step_content.tsx | 2 +- .../public/get_started/card_step/video.tsx | 86 --------------- .../context/__mocks__/step_context.tsx | 22 ++-- .../public/get_started/footer/footer.ts | 56 ++++++++++ .../public/get_started/footer/index.tsx | 39 +++++++ .../public/get_started/footer/translations.ts | 92 ++++++++++++++++ .../public/get_started/get_started.tsx | 9 +- .../public/get_started/helpers.ts | 37 +++++-- .../hooks/use_check_step_completed.test.tsx | 69 ++++++++++++ .../public/get_started/hooks/use_scroll.ts | 42 ++++++++ .../hooks/use_setup_sections.test.tsx | 4 - .../get_started/hooks/use_setup_sections.tsx | 10 +- .../get_started/hooks/use_toggle_panel.tsx | 98 +++++++++++++----- .../public/get_started/images/demo.png | Bin 0 -> 6642 bytes .../get_started/images/documentation.png | Bin 0 -> 7046 bytes .../public/get_started/images/forum.png | Bin 0 -> 9139 bytes .../public/get_started/images/labs.png | Bin 0 -> 9628 bytes .../public/get_started/progress_bar.tsx | 18 +--- .../public/get_started/sections.tsx | 85 ++++----------- .../step_links/add_integration_callout.tsx | 24 +---- .../get_started/styles/card_item.styles.ts | 8 +- .../get_started/styles/footer.styles.ts | 53 ++++++++++ .../get_started/styles/progress_bar.style.ts | 25 +++++ .../get_started/styles/step_content.styles.ts | 13 ++- .../styles/welcome_header.styles.ts | 4 +- .../public/get_started/toggle_panel.tsx | 1 - 39 files changed, 959 insertions(+), 261 deletions(-) create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/__mocks__/content_wrapper.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/add_integration_image.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/content_wrapper.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/create_project_step_image.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/enable_rule_image.tsx rename x-pack/plugins/security_solution_serverless/public/get_started/card_step/{ => content}/overview_video_description.tsx (96%) create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/video.test.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/video.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/view_alerts_image.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/view_dashboard_image.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/helpers.test.ts create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/helpers.ts delete mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/card_step/video.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/footer/footer.ts create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/footer/index.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/footer/translations.ts create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/hooks/use_check_step_completed.test.tsx create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/hooks/use_scroll.ts create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/images/demo.png create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/images/documentation.png create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/images/forum.png create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/images/labs.png create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/styles/footer.styles.ts create mode 100644 x-pack/plugins/security_solution_serverless/public/get_started/styles/progress_bar.style.ts diff --git a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/__mocks__/content_wrapper.tsx b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/__mocks__/content_wrapper.tsx new file mode 100644 index 0000000000000..442ef3a598bd7 --- /dev/null +++ b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/__mocks__/content_wrapper.tsx @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; + +export const ContentWrapper = ({ children }: { children: React.ReactElement }) => <>{children}; diff --git a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/add_integration_image.tsx b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/add_integration_image.tsx new file mode 100644 index 0000000000000..b9917c40e4056 --- /dev/null +++ b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/add_integration_image.tsx @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import connectToDataSources from '../../images/connect_to_existing_sources.png'; +import { ADD_INTEGRATIONS_IMAGE_TITLE } from '../../translations'; +import { ContentWrapper } from './content_wrapper'; + +const AddIntegrationsImageComponent = () => { + return ( + + {ADD_INTEGRATIONS_IMAGE_TITLE} + + ); +}; + +export const AddIntegrationsImage = React.memo(AddIntegrationsImageComponent); diff --git a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/content_wrapper.tsx b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/content_wrapper.tsx new file mode 100644 index 0000000000000..49b4765cbeb33 --- /dev/null +++ b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/content_wrapper.tsx @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { useStepContentStyles } from '../../styles/step_content.styles'; + +const ContentWrapperComponent: React.FC<{ children: React.ReactElement; shadow?: boolean }> = ({ + children, + shadow = true, +}) => { + const { getRightContentStyles } = useStepContentStyles(); + const rightContentStyles = getRightContentStyles({ shadow }); + + return ( +
+ {children} +
+ ); +}; + +export const ContentWrapper = React.memo(ContentWrapperComponent); diff --git a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/create_project_step_image.tsx b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/create_project_step_image.tsx new file mode 100644 index 0000000000000..268863033f9e8 --- /dev/null +++ b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/create_project_step_image.tsx @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import createProjects from '../../images/create_projects.png'; +import { CREATE_PROJECT_TITLE } from '../../translations'; +import { ContentWrapper } from './content_wrapper'; + +const CreateProjectImageComponent = () => ( + + {CREATE_PROJECT_TITLE} + +); + +export const CreateProjectImage = React.memo(CreateProjectImageComponent); diff --git a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/enable_rule_image.tsx b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/enable_rule_image.tsx new file mode 100644 index 0000000000000..2ef54493b7033 --- /dev/null +++ b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/enable_rule_image.tsx @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import enablePrebuiltRules from '../../images/enable_prebuilt_rules.png'; +import { ENABLE_RULES } from '../../translations'; +import { ContentWrapper } from './content_wrapper'; + +const EnableRuleImageComponent = () => ( + + {ENABLE_RULES} + +); + +export const EnableRuleImage = React.memo(EnableRuleImageComponent); diff --git a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/overview_video_description.tsx b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/overview_video_description.tsx similarity index 96% rename from x-pack/plugins/security_solution_serverless/public/get_started/card_step/overview_video_description.tsx rename to x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/overview_video_description.tsx index de8f272a0c25d..975119bf74e4f 100644 --- a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/overview_video_description.tsx +++ b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/overview_video_description.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { WATCH_VIDEO_DESCRIPTION1, WATCH_VIDEO_DESCRIPTION2 } from '../translations'; +import { WATCH_VIDEO_DESCRIPTION1, WATCH_VIDEO_DESCRIPTION2 } from '../../translations'; const OverviewVideoDescriptionComponent = () => ( <> diff --git a/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/video.test.tsx b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/video.test.tsx new file mode 100644 index 0000000000000..a02c89399ac99 --- /dev/null +++ b/x-pack/plugins/security_solution_serverless/public/get_started/card_step/content/video.test.tsx @@ -0,0 +1,81 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import { render, fireEvent, screen } from '@testing-library/react'; +import { Video } from './video'; +import { OverviewSteps, QuickStartSectionCardsId, SectionId } from '../../types'; +import type { EuiFlexGroupProps } from '@elastic/eui'; +import { useStepContext } from '../../context/step_context'; +import { WATCH_VIDEO_BUTTON_TITLE } from '../../translations'; +import { defaultExpandedCards } from '../../storage'; + +jest.mock('../../context/step_context'); +jest.mock('./content_wrapper'); + +jest.mock('@elastic/eui', () => ({ + EuiFlexGroup: ({ children, onClick }: EuiFlexGroupProps) => { + return ( + // eslint-disable-next-line jsx-a11y/click-events-have-key-events +
+ {children} +
+ ); + }, + EuiFlexItem: ({ children }: { children: React.ReactElement }) =>
{children}
, + EuiIcon: () => , + useEuiTheme: () => ({ euiTheme: { colors: { fullShade: '#000', emptyShade: '#fff' } } }), +})); + +describe('Video Component', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + it('renders overlay if step is not completed', () => { + const { getByTestId } = render(