vcc-ui
Version:
A React library for building user interfaces at Volvo Cars
96 lines (90 loc) • 2.04 kB
JavaScript
// TODO: Fix eslint issues the next time this file is edited.
/* eslint-disable jsx-a11y/aria-role */
import React, { useRef } from 'react';
import { Card } from 'vcc-ui';
// Considered a div if no `href` is provided
// `target` is `a` only attribute
/*#__PURE__*/React.createElement(Card, {
target: "blank"
});
/*#__PURE__*/React.createElement(Card, {
role: ""
});
// hrefLang is `a` attribute
/*#__PURE__*/React.createElement(Card, {
hrefLang: "lang",
onClick: e => {
console.log(e);
}
});
// Considered an `a` if `href` is provided
/*#__PURE__*/React.createElement(Card, {
href: "href",
hrefLang: "`a` only attribute"
});
/*#__PURE__*/React.createElement(Card, {
href: "href",
target: "blank"
});
/*#__PURE__*/React.createElement(Card, {
href: "href",
target: "blank",
selected: false
});
// allows children
/*#__PURE__*/React.createElement(Card, {
href: "href",
target: "blank"
}, /*#__PURE__*/React.createElement("div", null), "text");
// Allows multiple extend types
/*#__PURE__*/React.createElement(Card, {
extend: {
display: 'none'
}
});
/*#__PURE__*/React.createElement(Card, {
extend: _ref => {
let {
theme
} = _ref;
return {
color: theme.color.background.primary
};
}
});
/*#__PURE__*/React.createElement(Card, {
extend: [_ref2 => {
let {
theme
} = _ref2;
return {
color: theme.color.background.primary
};
}, {
display: 'none'
}, [_ref3 => {
let {
theme
} = _ref3;
return {
color: theme.color.background.primary
};
}, {
display: 'none'
}]]
});
// expects correct `ref` type
() => {
const imageRef = useRef(null);
const aRef = useRef(null);
const buttonRef = useRef(null);
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, {
href: "href",
ref: aRef
}), /*#__PURE__*/React.createElement(Card, {
href: "href",
ref: imageRef
}), /*#__PURE__*/React.createElement(Card, {
ref: buttonRef
}));
};