diff --git a/pages/collection-preferences/reorder-content.page.tsx b/pages/collection-preferences/reorder-content.page.tsx index 0a10cb2e9a..d821f78d0c 100644 --- a/pages/collection-preferences/reorder-content.page.tsx +++ b/pages/collection-preferences/reorder-content.page.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import React from 'react'; -import CollectionPreferences from '~components/collection-preferences'; +import { Box, CollectionPreferences, SpaceBetween } from '~components'; import { contentDisplayPreferenceI18nStrings } from '../common/i18n-strings'; import ScreenshotArea from '../utils/screenshot-area'; @@ -43,39 +43,126 @@ const longOptionsList = Array(50) .fill(1) .map((item, index) => ({ id: `id_${index}`, label: `Item ${index + 1}` })); +const optionListWithGroups = [ + { + id: 'id', + label: 'Item ID', + alwaysVisible: true, + }, + { id: 'name', label: 'Item name' }, + { + id: 'prices', + label: 'Prices', + options: [ + { + id: 'price-de', + label: 'Price DE', + }, + { + id: 'price-pl', + label: 'Price PL', + }, + { + id: 'price-uk', + label: 'Price UK', + }, + { + id: 'price-fr', + label: 'Price FR', + }, + { + id: 'price-it', + label: 'Price IT', + }, + ], + }, + { + id: 'attributes', + label: 'Attributes', + options: [ + { + id: 'size', + label: 'Size', + }, + { + id: 'weight', + label: 'Weight', + }, + { + id: 'battery', + label: 'Battery', + }, + { + id: 'power', + label: 'Power', + }, + { + id: 'condition', + label: 'Condition', + }, + ], + }, +]; + export default function App() { return (

CollectionPreferences page with content reordering

- - + + + + + No groups and no column filter + + + + + + No groups with column filter + + + + + + With groups with column filter +
); } diff --git a/pages/collection-preferences/simple.page.tsx b/pages/collection-preferences/simple.page.tsx index 8a5d4bbd7b..c45693eefd 100644 --- a/pages/collection-preferences/simple.page.tsx +++ b/pages/collection-preferences/simple.page.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import * as React from 'react'; +import { Box, SpaceBetween } from '~components'; import CollectionPreferences from '~components/collection-preferences'; import ScreenshotArea from '../utils/screenshot-area'; @@ -20,29 +21,48 @@ export default function CollectionPreferencesPermutations() { <>

CollectionPreferences page for screenshot tests

- - - - + + + + Table prefs with visible content + + + + + + Custom prefs only + + + + + + Single column with custom prefs + + + + + + Single column visible content + ); diff --git a/src/collection-preferences/content-display/content-display-option.scss b/src/collection-preferences/content-display/content-display-option.scss index 9ed1ed9e00..9da0766907 100644 --- a/src/collection-preferences/content-display/content-display-option.scss +++ b/src/collection-preferences/content-display/content-display-option.scss @@ -32,6 +32,9 @@ $border-radius: awsui.$border-radius-item; border-end-start-radius: $border-radius; border-end-end-radius: $border-radius; } +.content-display-option-nested { + padding-inline-start: awsui.$space-l; +} .content-display-option { list-style: none; @@ -62,6 +65,9 @@ $border-radius: awsui.$border-radius-item; @include styles.text-wrapping; padding-inline-end: awsui.$space-l; } +.content-display-option-group { + font-weight: bold; +} .drag-overlay { box-shadow: awsui.$shadow-container-active; diff --git a/src/collection-preferences/content-display/content-display-option.tsx b/src/collection-preferences/content-display/content-display-option.tsx index 0bbb10e7d3..b9284873c0 100644 --- a/src/collection-preferences/content-display/content-display-option.tsx +++ b/src/collection-preferences/content-display/content-display-option.tsx @@ -1,11 +1,12 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import React, { ForwardedRef, forwardRef } from 'react'; +import clsx from 'clsx'; import DragHandle, { DragHandleProps } from '../../internal/components/drag-handle'; import { useUniqueId } from '../../internal/hooks/use-unique-id'; import InternalToggle from '../../toggle/internal'; -import { OptionWithVisibility } from './utils'; +import { FlatOption } from './utils'; import styles from '../styles.css.js'; @@ -15,8 +16,8 @@ export const getClassName = (suffix?: string) => styles[[componentPrefix, suffix export interface ContentDisplayOptionProps { dragHandleAriaLabel?: string; listeners?: DragHandleProps['listeners']; - onToggle?: (option: OptionWithVisibility) => void; - option: OptionWithVisibility; + onToggle?: (option: FlatOption) => void; + option: FlatOption; disabled?: boolean; } @@ -33,10 +34,10 @@ const ContentDisplayOption = forwardRef( }; return ( -
+
-