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 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[terra-button] Create selectable button (#3940)
Co-authored-by: Sugan G <[email protected]> Co-authored-by: SM051274 <[email protected]>
- Loading branch information
1 parent
736a476
commit 6b6dbdf
Showing
11 changed files
with
141 additions
and
8 deletions.
There are no files selected for viewing
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
Binary file added
BIN
+3.74 KB
...eference/clinical-lowlight-theme/en/chrome_tiny/button-spec/selected-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.19 KB
...s__/reference/orion-fusion-theme/en/chrome_tiny/button-spec/selected-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.79 KB
...__/reference/terra-default-theme/en/chrome_tiny/button-spec/selected-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
31 changes: 31 additions & 0 deletions
31
packages/terra-core-docs/src/terra-dev-site/test/button/SelectableButton.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,31 @@ | ||
import React, { useState } from 'react'; | ||
import Button from 'terra-button'; | ||
import classNames from 'classnames/bind'; | ||
import styles from './ButtonTestCommon.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
const SelectableButton = () => { | ||
const [text, setText] = useState('Unselected'); | ||
|
||
const handleSelection = (event, toggledState) => { | ||
if (toggledState) { | ||
setText('Selected'); | ||
} else { | ||
setText('Unselected'); | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<p> | ||
Status: | ||
{' '} | ||
{text} | ||
</p> | ||
<Button text="Click Me" className={cx('button')} isSelectable onClick={handleSelection} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SelectableButton; |