Skip to content

Commit fbfdb12

Browse files
authored
revert: icons-for-expandable-buttons (#3701)
1 parent 0a89e18 commit fbfdb12

File tree

7 files changed

+2
-196
lines changed

7 files changed

+2
-196
lines changed

pages/button-dropdown/icon-expandable.page.tsx

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/button-dropdown/__tests__/button-dropdown-items.test.tsx

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ const checkRenderedGroup = (
4545
);
4646
}
4747
}
48-
49-
if (group.iconName || group.iconSvg || group.iconUrl) {
50-
expect(renderedItem.findIcon()).toBeTruthy();
51-
}
5248
};
5349

5450
const checkElementItem = (
@@ -436,44 +432,6 @@ const items: ButtonDropdownProps.Items = [
436432
wrapper.openDropdown();
437433
expect(wrapper.findItemById('i1')!.findAllIcons()).toHaveLength(2);
438434
});
439-
440-
test.each([true, false])('in category headers when expandableGroups is %s', expandableGroups => {
441-
const svg = (
442-
<svg className="test-svg" focusable="false">
443-
<circle className="test-svg-inner" cx="8" cy="8" r="7" />
444-
</svg>
445-
);
446-
const groupedCategories: ButtonDropdownProps.ItemOrGroup[] = [
447-
{
448-
id: 'category1',
449-
text: 'category1',
450-
iconName: 'folder',
451-
items: [{ id: 'i1', text: 'item1' }],
452-
},
453-
{
454-
id: 'category2',
455-
text: 'category2',
456-
iconUrl: 'data:image/png;base64,aaaa',
457-
items: [{ id: 'i2', text: 'item2' }],
458-
},
459-
{
460-
id: 'category3',
461-
text: 'category3',
462-
iconSvg: svg,
463-
items: [{ id: 'i3', text: 'item3' }],
464-
},
465-
];
466-
const wrapper = renderButtonDropdown({ ...props, expandableGroups, items: groupedCategories });
467-
wrapper.openDropdown();
468-
469-
if (expandableGroups) {
470-
expect(wrapper.findExpandableCategoryById('category1')!.findIcon()).toBeTruthy();
471-
expect(wrapper.findExpandableCategoryById('category2')!.findIcon()).toBeTruthy();
472-
expect(wrapper.findExpandableCategoryById('category3')!.findIcon()).toBeTruthy();
473-
} else {
474-
expect(wrapper.findOpenDropdown()!.findAllIcons()).toHaveLength(3);
475-
}
476-
});
477435
});
478436
});
479437
});

src/button-dropdown/__tests__/mobile-expandable-category.test.tsx

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import React from 'react';
44
import { render } from '@testing-library/react';
55

6-
import MobileExpandableCategoryElement from '../../../lib/components/button-dropdown/category-elements/mobile-expandable-category-element';
76
import MobileExpandableGroup from '../../../lib/components/button-dropdown/mobile-expandable-group/mobile-expandable-group';
87
import createWrapper from '../../../lib/components/test-utils/dom';
98

@@ -30,46 +29,3 @@ describe('MobileExpandableGroup Component', () => {
3029
expect(wrapper.find(`[data-open=true]`)).not.toBe(null);
3130
});
3231
});
33-
34-
describe('MobileExpandableCategoryElement icon rendering', () => {
35-
const mockProps = {
36-
onItemActivate: jest.fn(),
37-
onGroupToggle: jest.fn(),
38-
targetItem: null,
39-
isHighlighted: jest.fn(() => false),
40-
isKeyboardHighlight: jest.fn(() => false),
41-
isExpanded: jest.fn(() => false),
42-
lastInDropdown: false,
43-
highlightItem: jest.fn(),
44-
disabled: false,
45-
variant: 'normal' as const,
46-
position: '1',
47-
};
48-
49-
test('renders icon when iconName provided', () => {
50-
const item = { id: 'test', text: 'Test', iconName: 'settings' as const, items: [] };
51-
const wrapper = renderComponent(<MobileExpandableCategoryElement item={item} {...mockProps} />);
52-
expect(wrapper.findIcon()).toBeTruthy();
53-
});
54-
55-
test('renders icon when iconUrl provided', () => {
56-
const item = { id: 'test', text: 'Test', iconUrl: 'data:image/png;base64,test', items: [] };
57-
const wrapper = renderComponent(<MobileExpandableCategoryElement item={item} {...mockProps} />);
58-
expect(wrapper.findIcon()).toBeTruthy();
59-
});
60-
61-
test('renders icon when iconSvg provided', () => {
62-
const item = {
63-
id: 'test',
64-
text: 'Test',
65-
iconSvg: (
66-
<svg focusable="false">
67-
<circle />
68-
</svg>
69-
),
70-
items: [],
71-
};
72-
const wrapper = renderComponent(<MobileExpandableCategoryElement item={item} {...mockProps} />);
73-
expect(wrapper.findIcon()).toBeTruthy();
74-
});
75-
});

src/button-dropdown/category-elements/category-element.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import React from 'react';
44
import clsx from 'clsx';
55

6-
import InternalIcon from '../../icon/internal';
76
import { CategoryProps } from '../interfaces';
87
import ItemsList from '../items-list';
98

@@ -32,9 +31,6 @@ const CategoryElement = ({
3231
>
3332
{item.text && (
3433
<p className={clsx(styles.header, { [styles.disabled]: disabled })} aria-hidden="true">
35-
{(item.iconName || item.iconUrl || item.iconSvg) && (
36-
<InternalIcon name={item.iconName} url={item.iconUrl} svg={item.iconSvg} alt={item.iconAlt} />
37-
)}
3834
{item.text}
3935
</p>
4036
)}

src/button-dropdown/category-elements/expandable-category-element.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ const ExpandableCategoryElement = ({
9191
} as GeneratedAnalyticsMetadataButtonDropdownExpand | GeneratedAnalyticsMetadataButtonDropdownCollapse)
9292
)}
9393
>
94-
{(item.iconName || item.iconUrl || item.iconSvg) && (
95-
<InternalIcon name={item.iconName} url={item.iconUrl} svg={item.iconSvg} alt={item.iconAlt} />
96-
)}
9794
{item.text}
9895
<span className={clsx(styles['expand-icon'], styles['expand-icon-right'])}>
9996
<InternalIcon name="caret-down-filled" />

src/button-dropdown/category-elements/mobile-expandable-category-element.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ const MobileExpandableCategoryElement = ({
8383
} as GeneratedAnalyticsMetadataButtonDropdownExpand)
8484
)}
8585
>
86-
{(item.iconName || item.iconUrl || item.iconSvg) && (
87-
<InternalIcon name={item.iconName} url={item.iconUrl} svg={item.iconSvg} alt={item.iconAlt} />
88-
)}
8986
{item.text}
9087
<span
9188
className={clsx(styles['expand-icon'], {

src/button-dropdown/category-elements/styles.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
border-inline-width: 0;
1818
font-weight: bold;
1919
display: flex;
20-
gap: awsui.$space-xxs;
20+
justify-content: space-between;
2121
// to compensate for the loss of padding due to the removal of the left and right borders
2222
// and differences in default divider + selected border widths (visual refresh)
2323
padding-block: styles.$option-padding-with-border-placeholder-vertical;
@@ -113,7 +113,7 @@
113113

114114
&-right {
115115
transform: rotate(-90deg);
116-
margin-inline-start: auto;
116+
117117
@include styles.with-direction('rtl') {
118118
transform: rotate(90deg);
119119
}

0 commit comments

Comments
 (0)