Skip to content

Commit

Permalink
Extract "Header" core organism height shrink style value
Browse files Browse the repository at this point in the history
This improves the configuratibility and simplifies the testing.

GH-76
  • Loading branch information
arcticicestudio committed Dec 15, 2018
1 parent cd9bf4c commit 19a21ba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/organisms/core/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* License: MIT
*/

import { HEADER_HEIGHT, HEADER_HEIGHT_PINNED } from "./shared/styles";
import { HEADER_BRAND_LOGO_SHRINK_FACTOR, HEADER_HEIGHT, HEADER_HEIGHT_PINNED } from "./shared/styles";
import Header from "./Header";

export { HEADER_HEIGHT, HEADER_HEIGHT_PINNED };
export { HEADER_BRAND_LOGO_SHRINK_FACTOR, HEADER_HEIGHT, HEADER_HEIGHT_PINNED };
export default Header;
15 changes: 14 additions & 1 deletion src/components/organisms/core/Header/shared/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ import { rgba } from "polished";

import { colors, themedMode, MODE_BRIGHT_SNOW_FLURRY, MODE_DARK_NIGHT_FROST } from "styles/theme";

/**
* The factor with which the branding logo is multiplied by the height of the header based on the pin mode.
*
* @type {number}
*/
const HEADER_BRAND_LOGO_SHRINK_FACTOR = 0.45;

/**
* The default height (in `px`) of the header when in unpinned mode.
*
Expand All @@ -42,4 +49,10 @@ const linkBackgroundColorHover = themedMode({
[MODE_DARK_NIGHT_FROST]: rgba(colors.nord3, 0.8)
});

export { backgroundColor, linkBackgroundColorHover, HEADER_HEIGHT, HEADER_HEIGHT_PINNED };
export {
backgroundColor,
linkBackgroundColorHover,
HEADER_BRAND_LOGO_SHRINK_FACTOR,
HEADER_HEIGHT,
HEADER_HEIGHT_PINNED
};
6 changes: 4 additions & 2 deletions src/components/organisms/core/Header/styled/Logo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { em } from "polished";

import { Nord } from "atoms/core/vectors/logos";

import { HEADER_BRAND_LOGO_SHRINK_FACTOR } from "../shared/styles";

/**
* Nord's logo as SVG vector graphic component with a dynamic size based on the given `size` prop.
*
Expand All @@ -21,8 +23,8 @@ import { Nord } from "atoms/core/vectors/logos";
*/
const Logo = styled(Nord)`
display: block;
width: ${({ size }) => em(size * 0.45)};
height: ${({ size }) => em(size * 0.45)};
width: ${({ size }) => em(size * HEADER_BRAND_LOGO_SHRINK_FACTOR)};
height: ${({ size }) => em(size * HEADER_BRAND_LOGO_SHRINK_FACTOR)};
`;

export default Logo;

0 comments on commit 19a21ba

Please sign in to comment.