UNPKG

preact-material-components

Version:
99 lines 3.03 kB
import { h } from 'preact'; import MaterialComponent from '../Base/MaterialComponent'; import Button from '../Button'; import Icon from '../Icon'; export class CardActions extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'card__actions'; this.mdcProps = ['full-bleed']; } materialDom(props) { return h("div", Object.assign({}, props), this.props.children); } } export class CardMedia extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'card__media'; this.mdcProps = ['square', '16-9']; } materialDom(props) { if (props.sixteenByNine) { props.className = 'mdc-card__media--16-9'; } return h("div", Object.assign({}, props), this.props.children); } } export class CardActionButton extends Button { constructor() { super(...arguments); this.componentName = 'card__action'; this.mdcProps = []; } materialDom(props) { return (h("button", Object.assign({ className: "mdc-button mdc-card__action--button" }, props, { ref: this.setControlRef }), props.children)); } } export class CardActionIcons extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'card__action-icons'; this.mdcProps = []; } materialDom(props) { return h("div", Object.assign({}, props), this.props.children); } } export class CardActionButtons extends CardActionIcons { constructor() { super(...arguments); this.componentName = 'card__action-buttons'; } } export class CardActionIcon extends Icon { constructor() { super(...arguments); this.componentName = 'card__action'; this.mdcProps = []; } materialDom(props) { if (props.className) { props.className += ' mdc-card__action--icon'; } else { props.className = 'mdc-card__action--icon'; } return super.materialDom(props); } } export class CardMediaContent extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'card__media-content'; this.mdcProps = []; } materialDom(props) { return h("div", Object.assign({}, props), this.props.children); } } export class Card extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'card'; this.mdcProps = ['outlined']; } materialDom(props) { return h("div", Object.assign({}, props), this.props.children); } } export default class default_1 extends Card { } default_1.Actions = CardActions; default_1.ActionButtons = CardActionButtons; default_1.ActionButton = CardActionButton; default_1.ActionIcons = CardActionIcons; default_1.ActionIcon = CardActionIcon; default_1.Media = CardMedia; default_1.CardMediaContent = CardMediaContent; //# sourceMappingURL=index.js.map