From ac315e14b41361527240ee808fb095c18ba7f3cc Mon Sep 17 00:00:00 2001 From: sumanganguly Date: Tue, 13 Feb 2024 16:07:05 +1100 Subject: [PATCH] PDM-1528: New Latitude Logo --- package-lock.json | 2 +- package.json | 2 +- src/components/logo-list.js | 2 + src/logos/latitude-rebranded.js | 84 +++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 src/logos/latitude-rebranded.js diff --git a/package-lock.json b/package-lock.json index 44f27296..0698b77e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "basis", - "version": "1.70.0", + "version": "1.72.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5944806b..4787a69e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "basis", - "version": "1.71.0", + "version": "1.72.0", "description": "Basis Design System", "main": "dist/index.js", "module": "dist/esm/index.js", diff --git a/src/components/logo-list.js b/src/components/logo-list.js index 39fce649..14404143 100644 --- a/src/components/logo-list.js +++ b/src/components/logo-list.js @@ -1,7 +1,9 @@ import Gem from "../logos/gem"; import Latitude from "../logos/latitude"; +import LatitudeRebranded from "../logos/latitude-rebranded"; export const logoListMapping = { gem: Gem, latitude: Latitude, + "latitude-rebranded": LatitudeRebranded, }; diff --git a/src/logos/latitude-rebranded.js b/src/logos/latitude-rebranded.js new file mode 100644 index 00000000..dec0e7f8 --- /dev/null +++ b/src/logos/latitude-rebranded.js @@ -0,0 +1,84 @@ +import React from "react"; +import PropTypes from "prop-types"; +import useTheme from "../hooks/useTheme"; +import useBackground, { mapResponsiveValues } from "../hooks/useBackground"; +import useResponsivePropsCSS from "../hooks/useResponsivePropsCSS"; +import { + responsiveHeightType, + responsiveMaxWidthType, +} from "../hooks/useResponsiveProp"; +import { responsiveSize } from "../utils/css"; +import { mergeProps } from "../utils/component"; + +const COLORS = ["primary.blue.t100", "black", "white"]; + +const DEFAULT_PROPS = { + color: "primary.blue.t100", + height: "40px", +}; + +function LatitudeLogo(props) { + const theme = useTheme(); + const { bgMap } = useBackground(); + const colorMap = mapResponsiveValues( + bgMap, + (backgroundColor) => { + return ( + props.color ?? + (backgroundColor === "primary.blue.t100" + ? "white" + : "primary.blue.t100") + ); + }, + theme + ); + const mergedProps = mergeProps( + props, + DEFAULT_PROPS, + {}, + { + color: (color) => COLORS.includes(color), + } + ); + const { testId } = mergedProps; + const svgResponsiveCSS = useResponsivePropsCSS(mergedProps, DEFAULT_PROPS, { + height: responsiveSize("height"), + maxWidth: responsiveSize("maxWidth"), + }); + const pathResponsiveCSS = useResponsivePropsCSS(mergedProps, DEFAULT_PROPS, { + color: (propsAtBreakpoint, theme, bp) => { + return { + fill: theme.getColor(colorMap[bp]), + }; + }, + }); + + return ( + + + + ); +} + +LatitudeLogo.propTypes = { + color: PropTypes.oneOf(COLORS), + ...responsiveHeightType, + ...responsiveMaxWidthType, + testId: PropTypes.string, +}; + +export default LatitudeLogo;