generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 217
fix: Support icons for button dropdown groups #3710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
df637a4
Added icon rendering for expendable buttons in dropdown menus
mariksav f7526a9
2.Try: Added icon rendering for expendable buttons in dropdown menus
mariksav 8ffbe52
Icons for expandable buttons push to my dev branch
mariksav 2bd1b7c
Final changes
mariksav d83c3da
Change scenarios-expandable
mariksav 51f1d1c
rechange to initial state
mariksav 726cc31
New dev page and unit test for button dropdown
mariksav 313a818
Updated icon-expandable to only have one dropdown
mariksav 868a138
Changed style of button and added Screenshot Area
mariksav f481f46
Styles changed
mariksav 28a087f
Review changes
mariksav 26e5e78
FInal changes
mariksav 42b1d0e
Reviewer reequets applied
mariksav 32b12d5
Adjusted styling errors
mariksav 53e5b7e
Fixes for Layout
mariksav 32254fe
Styles changed
mariksav 95d5ae0
Style
mariksav c5183c8
fixed issue of too small window
mariksav 4d754e5
test
mariksav 5bd268d
trigger pipeline
mariksav a45ac5c
Removed unnecessary span wrapper
mariksav 763c2fb
Readded span wrapper
mariksav 61efcd3
Fixed inline styling
mariksav 67222cd
Merge branch 'main' into fix/icon-for-button-dropdown
mariksav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import React, { useContext } from 'react'; | ||
|
|
||
| import ButtonDropdown, { ButtonDropdownProps } from '~components/button-dropdown'; | ||
| import SpaceBetween from '~components/space-between'; | ||
|
|
||
| import AppContext, { AppContextType } from '../app/app-context'; | ||
| import ScreenshotArea from '../utils/screenshot-area'; | ||
|
|
||
| import styles from './styles.scss'; | ||
|
|
||
| export const items: ButtonDropdownProps['items'] = [ | ||
| { | ||
| id: 'category1', | ||
| text: 'category1', | ||
| iconName: 'gen-ai', | ||
| items: [...Array(2)].map((_, index) => ({ | ||
| id: 'category1Subitem' + index, | ||
| text: 'Sub item ' + index, | ||
| })), | ||
| }, | ||
| { | ||
| id: 'category2', | ||
| text: 'category2', | ||
| iconUrl: 'data:image/png;base64,aaaa', | ||
| items: [...Array(2)].map((_, index) => ({ | ||
| id: 'category2Subitem' + index, | ||
| text: 'Cat 2 Sub item ' + index, | ||
| })), | ||
| }, | ||
| { | ||
| id: 'item1', | ||
| text: 'Item 1', | ||
| iconName: 'settings', | ||
| }, | ||
| { | ||
| id: 'category3', | ||
| text: 'category3', | ||
| iconSvg: ( | ||
| <svg width="16" height="16" viewBox="0 0 16 16" fill="none" focusable="false"> | ||
| <path | ||
| d="M2 4V12C2 12.5523 2.44772 13 3 13H13C13.5523 13 14 12.5523 14 12V6C14 5.44772 13.5523 5 13 5H8L6 3H3C2.44772 3 2 3.44772 2 4Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ), | ||
| items: [...Array(2)].map((_, index) => ({ | ||
| id: 'category3Subitem' + index, | ||
| text: 'Sub item ' + index, | ||
| })), | ||
| }, | ||
| ]; | ||
|
|
||
| type DemoContext = React.Context< | ||
| AppContextType<{ | ||
| expandableGroups: boolean; | ||
| }> | ||
| >; | ||
|
|
||
| export default function IconExpandableButtonDropdown() { | ||
| const { | ||
| urlParams: { expandableGroups = true }, | ||
| setUrlParams, | ||
| } = useContext(AppContext as DemoContext); | ||
|
|
||
| return ( | ||
| <div className={styles.container}> | ||
| <article> | ||
| <h1>Icon Expandable Dropdown</h1> | ||
| <SpaceBetween size="m"> | ||
| <label> | ||
| <input | ||
| id="expandableGroups" | ||
| type="checkbox" | ||
| checked={expandableGroups} | ||
| onChange={e => setUrlParams({ expandableGroups: !!e.target.checked })} | ||
| />{' '} | ||
| expandableGroups | ||
| </label> | ||
| <ScreenshotArea | ||
| style={{ | ||
| paddingBlockStart: 10, | ||
| paddingBlockEnd: 300, | ||
| paddingInlineStart: 10, | ||
| paddingInlineEnd: 100, | ||
| display: 'inline-block', | ||
| }} | ||
| > | ||
| <ButtonDropdown expandableGroups={expandableGroups} items={items}> | ||
| Dropdown with Icons | ||
| </ButtonDropdown> | ||
| </ScreenshotArea> | ||
| </SpaceBetween> | ||
| </article> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the parent is going to be a
display: flex, I think you could just putgap: awsui.$space-xxson the parent and not have to deal with a wrapper.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was the same idea that I had as well, but it caused the caret to be misplaced in button-dropdown/disabled-reason. So I circumvented that issue with the wrapper