Skip to content

Commit 9fcfbff

Browse files
AndySeymour2904alisonjoseph
authored andcommitted
feat(ModalWrapper): Allow styling of buttonTrigger (carbon-design-system#947)
1 parent 9097a6a commit 9fcfbff

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/components/ModalWrapper/ModalWrapper-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('ModalWrapper', () => {
99
mockProps = {
1010
id: 'modal',
1111
buttonTriggerText: 'Test Modal',
12+
buttonTriggerClassName: 'btn-trigger',
1213
modalHeading: 'Transactional Modal',
1314
modalLabel: 'Test Modal Label',
1415
primaryButtonText: 'Save',

src/components/ModalWrapper/ModalWrapper.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export default class ModalWrapper extends React.Component {
99
handleOpen: PropTypes.func,
1010
children: PropTypes.node,
1111
id: PropTypes.string,
12-
buttonTriggerText: PropTypes.string,
12+
buttonTriggerText: PropTypes.node,
13+
buttonTriggerClassName: PropTypes.string,
1314
modalLabel: PropTypes.string,
1415
modalHeading: PropTypes.string,
1516
modalText: PropTypes.string,
@@ -66,6 +67,7 @@ export default class ModalWrapper extends React.Component {
6667
const {
6768
id,
6869
buttonTriggerText,
70+
buttonTriggerClassName,
6971
triggerButtonKind,
7072
modalLabel,
7173
modalHeading,
@@ -97,6 +99,7 @@ export default class ModalWrapper extends React.Component {
9799
}
98100
}}>
99101
<Button
102+
className={buttonTriggerClassName}
100103
disabled={disabled}
101104
kind={triggerButtonKind}
102105
onClick={this.handleOpen}>

src/components/ModalWrapper/__snapshots__/ModalWrapper-test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
exports[`ModalWrapper should render 1`] = `
44
<ModalWrapper
5+
buttonTriggerClassName="btn-trigger"
56
buttonTriggerText="Test Modal"
67
disabled={false}
78
handleSubmit={[MockFunction]}
@@ -18,6 +19,7 @@ exports[`ModalWrapper should render 1`] = `
1819
role="presentation"
1920
>
2021
<Button
22+
className="btn-trigger"
2123
disabled={false}
2224
iconDescription="Provide icon description if icon is used"
2325
kind="primary"
@@ -27,7 +29,7 @@ exports[`ModalWrapper should render 1`] = `
2729
type="button"
2830
>
2931
<button
30-
className="bx--btn bx--btn--primary"
32+
className="btn-trigger bx--btn bx--btn--primary"
3133
disabled={false}
3234
onClick={[Function]}
3335
tabIndex={0}

0 commit comments

Comments
 (0)