Add SoMeIcon component and use svg instead of png

This commit is contained in:
Aarni Halinen
2018-11-16 22:49:41 +02:00
parent a72fe97cef
commit 00eb1c459a
14 changed files with 71 additions and 13 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

-1
View File
@@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#fff;}</style></defs><title>flogo-HexRBG-Wht-1024</title><path class="cls-1" d="M967.48,0h-911A56.51,56.51,0,0,0,0,56.52v911A56.52,56.52,0,0,0,56.52,1024H547V628H414V473H547V359c0-132.26,80.77-204.28,198.76-204.28,56.51,0,105.08,4.21,119.24,6.09V299l-81.62,0c-64,0-76.38,30.49-76.38,75.23V473H860.49l-20,155H707v396H967.48A56.51,56.51,0,0,0,1024,967.48v-911A56.51,56.51,0,0,0,967.48,0Z"/></svg>

Before

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

@@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><defs><style>.cls-1{fill:#fff;}</style></defs><title>flogo-RGB-HEX-Blk-1024</title><path d="M967.48,0h-911A56.51,56.51,0,0,0,0,56.52v911A56.51,56.51,0,0,0,56.52,1024H547V628H414V473H547V358.93c0-132.26,80.77-204.28,198.76-204.28,56.51,0,105.08,4.21,119.24,6.09V299l-81.37,0c-64.2,0-76.63,30.51-76.63,75.28V473H860.49l-20,155H707v396H967.48A56.51,56.51,0,0,0,1024,967.48v-911A56.51,56.51,0,0,0,967.48,0Z"/><path id="f" class="cls-1" d="M707,1024V628H840.5l20-155H707V374.28c0-44.77,12.43-75.28,76.63-75.28L865,299V160.74c-14.16-1.88-62.73-6.09-119.24-6.09-118,0-198.76,72-198.76,204.28V473H414V628H547v396Z"/></svg>

Before

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

@@ -21,8 +21,3 @@ $border-width: 2px;
}
}
}
.some-icon {
width: 15px;
padding: 0.3rem;
}
+5 -6
View File
@@ -2,9 +2,8 @@ import * as React from "react";
import "./Navigation.scss";
import NavbarDropdownLink from "../NavbarDropdownLink/NavbarDropdownLink";
import NavbarChildLink from "../NavbarChildLink/NavbarChildLink";
const facebookLogo = require("../../assets/img/flogo-RGB-HEX-Blk-1024.png");
const instagramLogo = require("../../assets/img/glyph-logo_May2016.png");
const linkedInLogo = require("../../assets/img/In-Black-128px-TM.png");
import SoMeIcon from "../SoMeIcon/SoMeIcon";
import { SoMe } from "../SoMeIcon/SoMeIcon";
export interface NavigationProps {}
export interface NavigationState {}
@@ -22,9 +21,9 @@ class Navigation extends React.Component<NavigationProps, NavigationState> {
<NavbarDropdownLink to="/yritysyhteistyo" text="Yritysyhteistyö"></NavbarDropdownLink>
<NavbarDropdownLink to="/yhteystiedot" text="Yhteystiedot"></NavbarDropdownLink>
<NavbarDropdownLink to="/in_english" text="In English"></NavbarDropdownLink>
<a href="https://www.facebook.com/AaltoYliopistonSIK/"><img className="some-icon" src={facebookLogo} /></a>
<a href="https://www.instagram.com/sahkoinsinoorikilta/"><img className="some-icon" src={instagramLogo} /></a>
<a href="https://www.linkedin.com/groups/8103057/"><img className="some-icon" src={linkedInLogo} /></a>
<SoMeIcon name={SoMe.Facebook} link="https://www.facebook.com/AaltoYliopistonSIK/" />
<SoMeIcon name={SoMe.Instagram} link="https://www.instagram.com/sahkoinsinoorikilta/" />
<SoMeIcon name={SoMe.LinkedIn} link="https://www.linkedin.com/groups/8103057/" />
</div>
);
}
+8
View File
@@ -0,0 +1,8 @@
@import "../../assets/scss/globals";
.so-me-icon {
display: flex;
flex-flow: row nowrap;
justify-content: center;
margin: 1em;
}
+56
View File
@@ -0,0 +1,56 @@
import * as React from "react";
import "./SoMeIcon.scss";
export enum SoMe {
Facebook,
Instagram,
LinkedIn
}
export interface SoMeIconProps {
name: SoMe;
link: string;
}
export interface SoMeIconState {}
class SoMeIcon extends React.Component<SoMeIconProps, SoMeIconState> {
render() {
const { link, name } = this.props;
if (name === SoMe.Facebook) {
return (
<a href={ link } className="so-me-icon">
<svg role="img"
width="20px"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<title>Facebook icon</title>
<path d="M22.676 0H1.324C.593 0 0 .593 0 1.324v21.352C0 23.408.593 24 1.324 24h11.494v-9.294H9.689v-3.621h3.129V8.41c0-3.099 1.894-4.785 4.659-4.785 1.325 0 2.464.097 2.796.141v3.24h-1.921c-1.5 0-1.792.721-1.792 1.771v2.311h3.584l-.465 3.63H16.56V24h6.115c.733 0 1.325-.592 1.325-1.324V1.324C24 .593 23.408 0 22.676 0"/></svg>
</a>
);
} else if (name === SoMe.Instagram) {
return (
<a href={ link } className="so-me-icon">
<svg role="img"
width="20px"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<title>Instagram icon</title>
<path d="M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z"/></svg>
</a>
);
} else if (name === SoMe.LinkedIn) {
return (
<a href={ link } className="so-me-icon">
<svg role="img"
width="20px"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<title>LinkedIn icon</title>
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>
</a>
);
}
}
}
export default SoMeIcon;
+2
View File
@@ -0,0 +1,2 @@
import SoMeIcon from "./SoMeIcon";
export default SoMeIcon;