@servicetitan/design-system
Advanced tools
Comparing version
@@ -5,4 +5,6 @@ import * as React from 'react'; | ||
active?: boolean; | ||
children: JSX.Element | React.ReactNode; | ||
className?: string; | ||
dark?: boolean; | ||
disabled?: boolean; | ||
hoverable?: boolean; | ||
@@ -9,0 +11,0 @@ light?: boolean; |
@@ -32,3 +32,13 @@ var __extends = (this && this.__extends) || (function () { | ||
import { CardSection } from './CardSection'; | ||
// WHY DO WE NEED BOTH THESE FUNCTIONS?!?!?! | ||
var someByType = function (children, type) { return _.some(React.Children.toArray(children), { type: type }); }; | ||
var isChildrenOfType = function (children, Component) { | ||
var found = false; | ||
React.Children.forEach(children, function (child) { | ||
if (React.isValidElement(child) && child.type.prototype instanceof Component) { | ||
found = true; | ||
} | ||
}); | ||
return found; | ||
}; | ||
var Card = /** @class */ (function (_super) { | ||
@@ -40,3 +50,3 @@ __extends(Card, _super); | ||
Card.prototype.render = function () { | ||
var _a = this.props, className = _a.className, raised = _a.raised, thin = _a.thin, sharp = _a.sharp, hoverable = _a.hoverable, active = _a.active, light = _a.light, props = __rest(_a, ["className", "raised", "thin", "sharp", "hoverable", "active", "light"]); | ||
var _a = this.props, className = _a.className, disabled = _a.disabled, raised = _a.raised, thin = _a.thin, sharp = _a.sharp, hoverable = _a.hoverable, active = _a.active, light = _a.light, props = __rest(_a, ["className", "disabled", "raised", "thin", "sharp", "hoverable", "active", "light"]); | ||
var CardClasses = classnames('Card', className, { | ||
@@ -47,6 +57,7 @@ 'Card--raised': raised, | ||
'Card--hoverable': hoverable || this.props.onClick, | ||
'Card--active': active | ||
'Card--active': active, | ||
'Card--disabled': disabled | ||
}); | ||
var children = (React.createElement(CardSection, { light: light }, this.props.children)); | ||
if (someByType(this.props.children, CardSection)) { | ||
if (someByType(this.props.children, CardSection) || isChildrenOfType(this.props.children, CardSection)) { | ||
children = this.props.children; | ||
@@ -53,0 +64,0 @@ } |
{ | ||
"name": "@servicetitan/design-system", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/system.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
73251
3.53%1766
2.38%