From adf7df846e4acc511380a10cfd3d7f51d51cba30 Mon Sep 17 00:00:00 2001 From: Gethin Webster Date: Thu, 29 Oct 2026 09:59:49 +0000 Subject: [PATCH] feat: add headerSecondaryContent and hideHeaderText to ExpandableSection --- .../header-secondary-content.page.tsx | 234 +++++++++++++++++ .../__snapshots__/documenter.test.ts.snap | 19 +- .../__tests__/analytics-metadata.test.tsx | 18 ++ src/container/internal.tsx | 12 +- .../__tests__/analytics-metadata.test.tsx | 16 ++ .../__tests__/expandable-section.test.tsx | 237 ++++++++++++++++++ .../expandable-section-container.tsx | 10 + .../expandable-section-header.tsx | 157 ++++++++---- src/expandable-section/interfaces.ts | 13 + src/expandable-section/internal.tsx | 16 +- src/expandable-section/styles.scss | 32 +++ src/expandable-section/utils.ts | 4 + src/header/__tests__/header.test.tsx | 12 + src/header/interfaces.ts | 5 +- src/header/internal.tsx | 9 + src/header/styles.scss | 22 ++ 16 files changed, 765 insertions(+), 51 deletions(-) create mode 100644 pages/expandable-section/header-secondary-content.page.tsx diff --git a/pages/expandable-section/header-secondary-content.page.tsx b/pages/expandable-section/header-secondary-content.page.tsx new file mode 100644 index 00000000000..787c286181d --- /dev/null +++ b/pages/expandable-section/header-secondary-content.page.tsx @@ -0,0 +1,234 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import React, { useState } from 'react'; + +import Badge from '~components/badge'; +import Box from '~components/box'; +import Button from '~components/button'; +import ButtonGroup from '~components/button-group'; +import ExpandableSection from '~components/expandable-section'; +import Input from '~components/input'; +import Link from '~components/link'; +import Popover from '~components/popover'; +import Select, { SelectProps } from '~components/select'; +import SpaceBetween from '~components/space-between'; + +import { SimplePage } from '../app/templates'; + +const languageOptions: SelectProps.Options = [ + { label: 'SQL', value: 'sql' }, + { label: 'PPL', value: 'ppl' }, + { label: 'Logstash', value: 'logstash' }, +]; + +function StandardExample() { + return ( + + Content + + ); +} + +function CreateQueryExample() { + const [expanded, setExpanded] = useState(true); + const [language, setLanguage] = useState(languageOptions[0]); + return ( + setExpanded(detail.expanded)} + headerSecondaryContent={ + setLanguage(detail.selectedOption)} + options={languageOptions} + ariaLabel="Query language" + /> + + } + > + Configuration for {sectionName}. + + ); +} + +function HiddenHeaderTextSearchExample() { + const [value, setValue] = useState(''); + return ( + setValue(detail.value)} + placeholder="Search results" + ariaLabel="Search results" + /> + } + > + Results matching “{value || 'your query'}”. + + ); +} + +function AllHeaderSlotsExample() { + const [language, setLanguage] = useState(languageOptions[0]); + return ( + Info} + headerDescription="Saved queries for the production log group." + headerSecondaryContent={ +