Skip to content

Commit fbb8152

Browse files
committed
feat(UISrefActive): pass down className
UISrefActive now passes down `className`props to its child component together with the computed props
1 parent 103b57b commit fbb8152

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/components/UISrefActive.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface UISrefActiveProps {
2222
class?: string;
2323
exact?: Boolean;
2424
children?: any;
25+
className?: string;
2526
}
2627

2728
export interface UISrefActiveState {
@@ -51,6 +52,7 @@ class SrefActive extends Component<UISrefActiveProps, any> {
5152
router: PropTypes.object.isRequired,
5253
class: PropTypes.string.isRequired,
5354
children: PropTypes.element.isRequired,
55+
className: PropTypes.string,
5456
};
5557

5658
state = {
@@ -137,12 +139,13 @@ class SrefActive extends Component<UISrefActiveProps, any> {
137139

138140
render() {
139141
const { activeClasses } = this.state;
142+
const { className } = this.props;
140143
const children =
141144
activeClasses.length > 0
142145
? cloneElement(
143146
this.props.children,
144147
Object.assign({}, this.props.children.props, {
145-
className: classNames(this.props.children.props.className, activeClasses),
148+
className: classNames(className, this.props.children.props.className, activeClasses),
146149
})
147150
)
148151
: this.props.children;

src/components/UIView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ export interface UIViewInjectedProps {
8787

8888
/** Component Props for `UIView` */
8989
export interface UIViewProps {
90-
router: UIRouterReact;
91-
parentUIView: UIViewAddress;
90+
router?: UIRouterReact;
91+
parentUIView?: UIViewAddress;
9292
name?: string;
9393
className?: string;
9494
style?: Object;
@@ -268,7 +268,7 @@ class View extends Component<UIViewProps, UIViewState> {
268268
}
269269
}
270270

271-
export class UIView extends React.Component {
271+
export class UIView extends React.Component<UIViewProps, any> {
272272
static displayName = 'UIView';
273273
static __internalViewComponent: React.ComponentClass<UIViewProps> = View;
274274

0 commit comments

Comments
 (0)