vcc-ui
Version:
VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.
47 lines (42 loc) • 1.17 kB
JavaScript
import React from "react";
import PropTypes from "prop-types";
import { useFela } from "react-fela";
import { Block } from "../block";
import { getImagesSrc } from "./helpers";
import { getThemeStyle } from "../../get-theme-style";
export function Logo(_ref) {
var type = _ref.type,
height = _ref.height,
altText = _ref.altText;
var _useFela = useFela(),
theme = _useFela.theme;
var _getImagesSrc = getImagesSrc({
type: type,
theme: theme
}),
src = _getImagesSrc.src,
srcSet = _getImagesSrc.srcSet;
return React.createElement(Block, {
as: "img",
src: src,
srcSet: srcSet,
alt: altText,
height: height,
extend: {
verticalAlign: "middle",
maxHeight: "100%",
// this allows passing a function of theme
// as a generic extension via theme
extend: getThemeStyle("logo", theme)
}
});
}
Logo.propTypes = {
/** Logo type */
// type: PropTypes.oneOf([LOGO_TYPES.SQUARE, LOGO_TYPES.WORDMARK]),
type: PropTypes.string,
/** Apply custom height to logo image */
height: PropTypes.number,
/** Alternative text for the logo image */
altText: PropTypes.string
};