This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
[terra-dropdown-button] Add support for icons in split button #4080
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1ceedae
[terra-dropdown-button] Add support for icons in split button
sycombs 17e04ad
Update changelogs
sycombs 9e561b5
Remove extraneous setMessages
sycombs 5934a94
Fix lint again
sycombs 40003a0
Fix wdio test order
sycombs 04a6cc0
use actual reply icon in docs examples
sycombs a1f3efc
Merge remote-tracking branch 'origin/main' into split-button_add-icon
sycombs 7396391
Combine WDIO tests
sycombs 79a2f90
Fix lint
sycombs d956a49
Update package-lock.json
sycombs 9cbd36d
Revert "Update package-lock.json"
sycombs 57976dd
Merge remote-tracking branch 'origin/main' into split-button_add-icon
sycombs f66ce00
Add labels
sycombs def249f
Remove blank classname attribute
sycombs b1017fd
Merge remote-tracking branch 'origin/main' into split-button_add-icon
sycombs 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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
59 changes: 59 additions & 0 deletions
59
packages/terra-core-docs/src/terra-dev-site/doc/dropdown-button/example/IconSplitButton.jsx
This file contains 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,59 @@ | ||
import React from 'react'; | ||
import { Item, SplitButton } from 'terra-dropdown-button'; | ||
import { IconReply } from 'terra-icon'; | ||
|
||
import classNames from 'classnames/bind'; | ||
import styles from './IconSplitButton.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
const Example = () => ( | ||
<> | ||
<SplitButton | ||
primaryOptionLabel="Reply" | ||
icon={<IconReply />} | ||
onSelect={() => {}} | ||
buttonAttrs={{ | ||
'aria-label': 'icon split', | ||
}} | ||
className={cx('icon-button')} | ||
> | ||
<Item label="Reply All" onSelect={() => {}} /> | ||
<Item label="Forward" onSelect={() => {}} /> | ||
<Item label="Reply in 10 minutes" onSelect={() => {}} /> | ||
<Item label="Selective Reply" onSelect={() => {}} /> | ||
</SplitButton> | ||
<SplitButton | ||
primaryOptionLabel="Reply" | ||
icon={<IconReply />} | ||
isReversed | ||
onSelect={() => {}} | ||
buttonAttrs={{ | ||
'aria-label': 'reverse icon split', | ||
}} | ||
className={cx('icon-button')} | ||
> | ||
<Item label="Reply All" onSelect={() => {}} /> | ||
<Item label="Forward" onSelect={() => {}} /> | ||
<Item label="Reply in 10 minutes" onSelect={() => {}} /> | ||
<Item label="Selective Reply" onSelect={() => {}} /> | ||
</SplitButton> | ||
<SplitButton | ||
primaryOptionLabel="Reply" | ||
icon={<IconReply />} | ||
isIconOnly | ||
onSelect={() => {}} | ||
buttonAttrs={{ | ||
'aria-label': 'icon only split', | ||
}} | ||
className={cx('icon-button')} | ||
> | ||
<Item label="Reply All" onSelect={() => {}} /> | ||
<Item label="Forward" onSelect={() => {}} /> | ||
<Item label="Reply in 10 minutes" onSelect={() => {}} /> | ||
<Item label="Selective Reply" onSelect={() => {}} /> | ||
</SplitButton> | ||
</> | ||
); | ||
|
||
export default Example; |
5 changes: 5 additions & 0 deletions
5
...erra-core-docs/src/terra-dev-site/doc/dropdown-button/example/IconSplitButton.module.scss
This file contains 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,5 @@ | ||
:local { | ||
.icon-button { | ||
margin: 5px; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
packages/terra-core-docs/src/terra-dev-site/test/dropdown-button/IconSplitButton.test.jsx
This file contains 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,58 @@ | ||
import React from 'react'; | ||
import classnames from 'classnames/bind'; | ||
import { SplitButton, Item } from 'terra-dropdown-button'; | ||
import { IconFeaturedOutlineYellow } from 'terra-icon'; | ||
import styles from './ExtraSpacing.module.scss'; | ||
|
||
const cx = classnames.bind(styles); | ||
|
||
const RightIconSplitButton = () => ( | ||
<div className={cx('container-spacing-wrapper')}> | ||
<h3>Icon Left</h3> | ||
<div className={cx('button-spacing-wrapper')}> | ||
<SplitButton | ||
primaryOptionLabel="Split" | ||
icon={<IconFeaturedOutlineYellow />} | ||
metaData={{ key: 'primary-button' }} | ||
onSelect={() => {}} | ||
id="left-icon" | ||
> | ||
<Item id="opt1" label="1st" metaData={{ key: '1st Option' }} onSelect={() => {}} /> | ||
<Item id="opt2" label="2nd" metaData={{ key: '2nd Option' }} onSelect={() => {}} /> | ||
<Item id="opt3" label="3rd" metaData={{ key: '3rd Option' }} onSelect={() => {}} /> | ||
</SplitButton> | ||
</div> | ||
<h3>Icon Right</h3> | ||
<div className={cx('button-spacing-wrapper')}> | ||
<SplitButton | ||
primaryOptionLabel="Split" | ||
icon={<IconFeaturedOutlineYellow />} | ||
isReversed | ||
metaData={{ key: 'primary-button' }} | ||
onSelect={() => {}} | ||
id="right-icon" | ||
> | ||
<Item id="opt1" label="1st" metaData={{ key: '1st Option' }} onSelect={() => {}} /> | ||
<Item id="opt2" label="2nd" metaData={{ key: '2nd Option' }} onSelect={() => {}} /> | ||
<Item id="opt3" label="3rd" metaData={{ key: '3rd Option' }} onSelect={() => {}} /> | ||
</SplitButton> | ||
</div> | ||
<h3>Icon Only</h3> | ||
<div className={cx('button-spacing-wrapper')}> | ||
<SplitButton | ||
primaryOptionLabel="Split" | ||
icon={<IconFeaturedOutlineYellow />} | ||
isIconOnly | ||
metaData={{ key: 'primary-button' }} | ||
onSelect={() => {}} | ||
id="icon-only" | ||
> | ||
<Item id="opt1" label="1st" metaData={{ key: '1st Option' }} onSelect={() => {}} /> | ||
<Item id="opt2" label="2nd" metaData={{ key: '2nd Option' }} onSelect={() => {}} /> | ||
<Item id="opt3" label="3rd" metaData={{ key: '3rd Option' }} onSelect={() => {}} /> | ||
</SplitButton> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default RightIconSplitButton; |
This file contains 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 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 |
---|---|---|
|
@@ -57,5 +57,8 @@ | |
"LICENSE", | ||
"NOTICE", | ||
"README.md" | ||
] | ||
], | ||
"devDependencies": { | ||
"terra-icon": "^3.60.0" | ||
} | ||
} |
This file contains 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 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 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 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 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.
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.
Added this as a devDependency for use in Jest tests