Skip to content

Commit

Permalink
Implement "Header" SVG vector icon and logo components
Browse files Browse the repository at this point in the history
This commit adds some icons of the awesome "Eva Icons" (1) project and
the official Nord logo as SVG components. They are loaded with the SVGR
webpack loader added in #72.

References:
  (1) https://akveo.github.io/eva-icons

GH-64
  • Loading branch information
arcticicestudio committed Dec 13, 2018
1 parent 89c016c commit e599573
Show file tree
Hide file tree
Showing 16 changed files with 308 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/assets/images/.gitkeep

This file was deleted.

5 changes: 5 additions & 0 deletions src/assets/images/icons/eva-icons/menu-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/images/icons/eva-icons/moon-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/images/icons/eva-icons/moon-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/images/icons/eva-icons/sun-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/images/icons/eva-icons/sun-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/images/logos/nord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/components/atoms/core/vectors/icons/Menu.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

import React from "react";
import styled from "styled-components";

import { ReactComponent as MenuSVGOutline } from "assets/images/icons/eva-icons/menu-outline.svg";

import { iconDefaultProps, iconPropTypes, themeModeFillColorStyles } from "../shared";

const MenuIconOutline = styled(MenuSVGOutline)`
${themeModeFillColorStyles};
`;

/**
* The "menu" icon from "Eva Icons" as SVG vector graphic component.
* By default, it uses the fill color and transition based on the current active global theme mode.
*
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://akveo.github.io/eva-icons
* @since 0.3.0
*/
const Menu = ({ svgRef }) => <MenuIconOutline svgRef={svgRef} />;

Menu.propTypes = iconPropTypes;

Menu.defaultProps = iconDefaultProps;

export default Menu;
43 changes: 43 additions & 0 deletions src/components/atoms/core/vectors/icons/Moon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

import React from "react";
import styled from "styled-components";

import { ReactComponent as MoonSVGFill } from "assets/images/icons/eva-icons/moon-fill.svg";
import { ReactComponent as MoonSVGOutline } from "assets/images/icons/eva-icons/moon-outline.svg";

import { iconDefaultProps, iconPropTypes, themeModeFillColorStyles } from "../shared";

const MoonIconFill = styled(MoonSVGFill)`
${themeModeFillColorStyles};
`;

const MoonIconOutline = styled(MoonSVGOutline)`
${themeModeFillColorStyles};
`;

/**
* The "moon" icon from "Eva Icons" as SVG vector graphic component.
* The "outline" variant can be used by passing the `outlined` boolean prop.
* By default, it uses the fill color and transition based on the current active global theme mode.
*
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://akveo.github.io/eva-icons
* @since 0.3.0
*/
const Moon = ({ outlined, svgRef }) =>
outlined ? <MoonIconOutline svgRef={svgRef} /> : <MoonIconFill svgRef={svgRef} />;

Moon.propTypes = iconPropTypes;

Moon.defaultProps = iconDefaultProps;

export default Moon;
42 changes: 42 additions & 0 deletions src/components/atoms/core/vectors/icons/Sun.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

import React from "react";
import styled from "styled-components";

import { ReactComponent as SunSVGFill } from "assets/images/icons/eva-icons/sun-fill.svg";
import { ReactComponent as SunSVGOutline } from "assets/images/icons/eva-icons/sun-outline.svg";

import { iconDefaultProps, iconPropTypes, themeModeFillColorStyles } from "../shared";

const SunIconFill = styled(SunSVGFill)`
${themeModeFillColorStyles};
`;

const SunIconOutline = styled(SunSVGOutline)`
${themeModeFillColorStyles};
`;

/**
* The "sun" icon from "Eva Icons" as SVG vector graphic component.
* The "outline" variant can be used by passing the `outlined` boolean prop.
* By default, it uses the fill color and transition based on the current active global theme mode.
*
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://akveo.github.io/eva-icons
* @since 0.3.0
*/
const Sun = ({ outlined, svgRef }) => (outlined ? <SunIconOutline svgRef={svgRef} /> : <SunIconFill svgRef={svgRef} />);

Sun.propTypes = iconPropTypes;

Sun.defaultProps = iconDefaultProps;

export default Sun;
22 changes: 22 additions & 0 deletions src/components/atoms/core/vectors/icons/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides SVG vector graphic icon components.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://developer.mozilla.org/de/docs/Web/SVG
* @since 0.3.0
*/

import Menu from "./Menu";
import Moon from "./Moon";
import Sun from "./Sun";

export { Menu, Moon, Sun };
28 changes: 28 additions & 0 deletions src/components/atoms/core/vectors/logos/Nord.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

import styled from "styled-components";

import { ReactComponent as NordSVG } from "assets/images/logos/nord.svg";

import { themeModeFillColorStyles } from "../shared";

/**
* The Nord logo as SVG vector graphic component.
* By default, it uses the fill color and transition based on the current active global theme mode.
*
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/
const Nord = styled(NordSVG)`
${themeModeFillColorStyles};
`;

export default Nord;
21 changes: 21 additions & 0 deletions src/components/atoms/core/vectors/logos/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides SVG vector graphic logo components.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://developer.mozilla.org/de/docs/Web/SVG
* @since 0.3.0
*/

import Nord from "./Nord";

/* eslint-disable-next-line import/prefer-default-export */
export { Nord };
21 changes: 21 additions & 0 deletions src/components/atoms/core/vectors/shared/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides shared vector graphic components and styles.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://developer.mozilla.org/de/docs/Web/SVG
* @since 0.3.0
*/

import { iconDefaultProps, iconPropTypes } from "./propTypes";
import { themeModeFillColorStyles } from "./styles";

export { iconDefaultProps, iconPropTypes, themeModeFillColorStyles };
37 changes: 37 additions & 0 deletions src/components/atoms/core/vectors/shared/propTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides shared prop types.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://reactjs.org/docs/typechecking-with-proptypes.html
* @since 0.3.0
*/

import PropTypes from "prop-types";

const iconPropTypes = {
/**
* Flag to toggle the "outline" icon variant.
*/
outlined: PropTypes.bool,

/**
* The React `ref` to be forwarded to the underlying SVG component.
*/
svgRef: PropTypes.func
};

const iconDefaultProps = {
outlined: false,
svgRef: () => {}
};

export { iconDefaultProps, iconPropTypes };
37 changes: 37 additions & 0 deletions src/components/atoms/core/vectors/shared/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file Provides shared vector graphic component styles.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/

import { css } from "styled-components";

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

const themeModeFillColor = themedMode({
[MODE_BRIGHT_SNOW_FLURRY]: colors.font.base[MODE_BRIGHT_SNOW_FLURRY],
[MODE_DARK_NIGHT_FROST]: colors.font.base[MODE_DARK_NIGHT_FROST]
});

/**
* The value and transition for the fill color based on the active global theme mode.
*
* @since 0.3.0
*/
const themeModeFillColorStyles = css`
fill: ${themeModeFillColor};
transition: fill ${motion.speed.duration.transition.base.themeModeSwitch}s ease-in-out;
`;

/* eslint-disable-next-line import/prefer-default-export */
export { themeModeFillColorStyles };

0 comments on commit e599573

Please sign in to comment.