Skip to content
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

fix(wizard): add className prop and spread attribute #572

Merged
merged 2 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/Tearsheet/Tearsheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Close20 from '@carbon/icons-react/lib/close/20';
import TrashCan20 from '@carbon/icons-react/lib/trash-can/20';

import PropTypes from 'prop-types';
import classnames from 'classnames';
import React, { Component } from 'react';

import Button from '../Button';
Expand Down Expand Up @@ -53,6 +54,7 @@ class Tearsheet extends Component {

render() {
const {
className,
focusTrap,
selectorPrimaryFocus,
renderSidebar,
Expand All @@ -76,6 +78,7 @@ class Tearsheet extends Component {
onClick: onDeleteButtonClick,
},
labels,
...other
} = this.props;

const componentLabels = {
Expand Down Expand Up @@ -103,8 +106,9 @@ class Tearsheet extends Component {
>
<section
ref={this.containerSection}
className={namespace}
className={classnames(namespace, className)}
aria-hidden={false}
{...other}
>
{this.state.loading && (
<Loading className={`${namespace}__loading`}>
Expand Down Expand Up @@ -296,9 +300,13 @@ Tearsheet.propTypes = {

/** @type {array} Array of event types to stop propagation. */
stopPropagationEvents: PropTypes.arrayOf(PropTypes.oneOf(PORTAL_EVENTS)),

/** Optional class name for the tearsheet wrapper node. */
className: PropTypes.string,
};

Tearsheet.defaultProps = {
className: '',
focusTrap: true,
selectorPrimaryFocus: '[tearsheet-primary-focus]',
renderMain: () => null,
Expand Down
9 changes: 8 additions & 1 deletion src/components/Wizard/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/* eslint-disable compat/compat,no-nested-ternary */

import React, { Component, Children } from 'react';
import classnames from 'classnames';
import PropTypes from 'prop-types';
import { StepIndicator, Step as SingleStep } from '../..';
import WizardStep from './WizardStep';
Expand Down Expand Up @@ -235,7 +236,7 @@ class Wizard extends Component {
* Renders the component.
*/
render() {
const { labels } = this.props;
const { labels, ...other } = this.props;
const componentLabels = {
...defaultLabels.labels,
...labels,
Expand Down Expand Up @@ -330,6 +331,8 @@ class Wizard extends Component {
}}
loading={this.state.loading}
loadingMessage={this.props.loadingMessage}
className={classnames(namespace, this.props.className)}
{...other}
/>
);
}
Expand Down Expand Up @@ -378,9 +381,13 @@ Wizard.propTypes = {
* (useful to override default labels)
*/
labels: defaultLabels.propType,

/** Optional class name for the wrapper node. */
className: PropTypes.string,
};

Wizard.defaultProps = {
className: '',
focusTrap: true,
rootNode: isClient() ? document.body : undefined,
subTitle: '',
Expand Down