UNPKG

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.

43 lines (38 loc) 960 B
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({ type, height, altText }) { const { theme } = useFela(); const { src, srcSet } = getImagesSrc({ type, theme }); return ( <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 };