-
Notifications
You must be signed in to change notification settings - Fork 6
button group component #541
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
17 commits
Select commit
Hold shift + click to select a range
cf4edfb
feat: button group component
daniele-zurico d289a2b
onClick feature
JadhavJeet 9387886
feat: upgrade branch
daniele-zurico 2122179
feat: upgrade branch
daniele-zurico 79cde33
Selected and advanced onClick
JadhavJeet 93c8b04
feat: fix type
daniele-zurico 4db8baf
buttonGroupProps and stories
JadhavJeet ef52f47
code fix
JadhavJeet dd4400d
selected prop logic
JadhavJeet 571c955
Design system folder removed
JadhavJeet ca6e1f1
removed button-group css file
JadhavJeet 42dc1a8
removed extra line
JadhavJeet a389647
Selected array logic
JadhavJeet 0ece4c5
styles in classbased stories
JadhavJeet ce3dcad
code and classbased stories changes
JadhavJeet 0d74c45
feat: fix minor doc
daniele-zurico 400c2e2
feat: fix minor doc
daniele-zurico 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
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,9 @@ | ||
| .active-class{ | ||
| background-color: yellow; | ||
| } | ||
|
|
||
| .dcx-button-group-layout--vertical { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| } |
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,93 @@ | ||
| import React from 'react'; | ||
| import { ButtonGroup, Button } from '@capgeminiuk/dcx-react-library'; | ||
| import './ButtonGroupDemo.scss'; | ||
|
|
||
| export const ButtonGroupDemo = () => { | ||
| const handleClick = ( | ||
| evt: React.MouseEvent<HTMLButtonElement>, | ||
| selected: (string | number)[] | ||
| ) => { | ||
| console.log('Event:', evt); | ||
| console.log('Selected:', selected); | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <h2>ButtonGroup example when no type provided</h2> | ||
| <ButtonGroup buttonsVariant="primary" onClick={handleClick}> | ||
| <Button label="Button 1" id="123" /> | ||
| <Button label="Button 2" value={'abc'} /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2>ButtonGroup example when type is Single toggle</h2> | ||
| <ButtonGroup buttonsVariant="secondary" type="single"> | ||
| <Button label="Button 1" /> | ||
| <Button label="Button 2" /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2>ButtonGroup example when type is Multiple toggle</h2> | ||
| <ButtonGroup type="multiple"> | ||
| <Button label="Button 1" /> | ||
| <Button label="Button 2" /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2>ButtonGroup example when layout is vertical</h2> | ||
| <ButtonGroup layout="vertical"> | ||
| <Button label="Button 1" id="123" /> | ||
| <Button label="Button 2" value={'abc'} /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2> | ||
| ButtonGroup example with multiple toggle when Id and value attributes | ||
| are provided | ||
| </h2> | ||
| <ButtonGroup | ||
| buttonsVariant="secondary" | ||
| type="multiple" | ||
| onClick={handleClick} | ||
| > | ||
| <Button label="Button 1" id="123" /> | ||
| <Button label="Button 2" value={'abc'} /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2>ButtonGroup example with ButtonsClassname prop</h2> | ||
| <ButtonGroup | ||
| buttonsVariant="secondary" | ||
| type="multiple" | ||
| buttonsClassName="test" | ||
| > | ||
| <Button label="Button 1" id="123" /> | ||
| <Button label="Button 2" value={'abc'} /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2>ButtonGroup example with selected prop</h2> | ||
| <ButtonGroup type="multiple" selected={[2, 'abc', '123']}> | ||
| <Button label="Button 1" id="123" /> | ||
| <Button label="Button 2" value={'abc'} /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2>ButtonGroup example with disabled prop</h2> | ||
| <ButtonGroup buttonsVariant="secondary" type="multiple" disabled> | ||
| <Button label="Button 1" id="123" /> | ||
| <Button label="Button 2" value={'abc'} /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <h2>ButtonGroup example with buttonGroupProps prop</h2> | ||
| <ButtonGroup buttonGroupProps={{ style: { color: 'red' } }}> | ||
| <Button label="Button 1" id="123" /> | ||
| <Button label="Button 2" value={'abc'} /> | ||
| <Button label="Button 3" /> | ||
| </ButtonGroup> | ||
|
|
||
| <div style={{ marginBottom: 50 }}></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
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.
Uh oh!
There was an error while loading. Please reload this page.