Browse Source

Open social media links in new tab and add Medium icon (#143)

* Open social media in new tab and add Medium

svg file pulled from Medium post on their logos
and brand guides dated Aug 22, 2017

https://medium.design/logos-and-brand-guidelines-f1a01a733592

* Add new-window accessibility icon for social media icons

Visible on-hover of link-transition class, this PR also
adds a description to the social media icons indicating that
they will open in a new window.

This way, users will be able to see and hear (via a reader)
when a tab will open in a new window.

This approach is based on the one outlined here:
https://medium.com/@svinkle/why-let-someone-know-when-a-link-opens-a-new-window-8699d20ed3b1
tags/2.36
Hannah Henderson 6 years ago
parent
commit
04a27b7ed9

+ 1
- 1
data/webpack_assets.json View File

@@ -1,6 +1,6 @@
{
"app": {
"js": "js/app.3fc0f988d21662902933.js",
"css": "css/app.e08a958ae3e530145318b6373195c765.css"
"css": "css/app.955516233bcafa4d2a1c13cea63c7b50.css"
}
}

+ 2
- 0
layouts/partials/new-window-icon.html View File

@@ -0,0 +1,2 @@
{{ $new_window_icon_size := "8px" }}
<span class="new-window">{{ partial "svg/new-window.svg" (dict "size" $new_window_icon_size) }}</span>

+ 39
- 21
layouts/partials/social-follow.html View File

@@ -1,37 +1,55 @@
<!-- TODO: Add follow intents where available TODO: Revisit color and hover color -->
<div hidden>
<span id="new-window-0">Opens in a new window</span>
<span id="new-window-1">Opens an external site</span>
<span id="new-window-2">Opens an external site in a new window</span>
</div>
{{ $icon_size := "32px" }}
{{ with .Param "facebook" }}
<a href="{{ . }}" class="link-transition facebook link dib z-999 pt3 pt0-l mr2" title="Facebook link">
{{ partial "svg/facebook.svg" (dict "size" $icon_size) }}
</a>
<a href="{{ . }}" target="_blank" class="link-transition facebook link dib z-999 pt3 pt0-l mr1" title="Facebook link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/facebook.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "twitter" }}
<a href="{{ . }}" class="link-transition twitter link dib z-999 pt3 pt0-l mr2" title="Twitter link">
{{ partial "svg/twitter.svg" (dict "size" $icon_size) }}
</a>
<a href="{{ . }}" target="_blank" class="link-transition twitter link dib z-999 pt3 pt0-l mr1" title="Twitter link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/twitter.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "instagram" }}
<a href="{{ . }}" class="link-transition instagram link dib z-999 pt3 pt0-l mr2" title="Instagram link">
{{ partial "svg/instagram.svg" (dict "size" $icon_size) }}
</a>
<a href="{{ . }}" target="_blank" class="link-transition instagram link dib z-999 pt3 pt0-l mr1" title="Instagram link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/instagram.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "youtube" }}
<a href="{{ . }}" class="link-transition youtube link dib z-999 pt3 pt0-l mr2" title="Youtube link">
{{ partial "svg/youtube.svg" (dict "size" $icon_size) }}
</a>
<a href="{{ . }}" target="_blank" class="link-transition youtube link dib z-999 pt3 pt0-l mr1" title="Youtube link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/youtube.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "linkedin" }}
<a href="{{ . }}" class="link-transition linkedin link dib z-999 pt3 pt0-l mr2" title="LinkedIn link">
{{ partial "svg/linkedin.svg" (dict "size" $icon_size) }}
</a>
<a href="{{ . }}" target="_blank" class="link-transition linkedin link dib z-999 pt3 pt0-l mr1" title="LinkedIn link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/linkedin.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "github" }}
<a href="{{ . }}" class="link-transition github link dib z-999 pt3 pt0-l mr2" title="Github link">
{{ partial "svg/github.svg" (dict "size" $icon_size) }}
</a>
<a href="{{ . }}" target="_blank" class="link-transition github link dib z-999 pt3 pt0-l mr1" title="Github link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/github.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "gitlab" }}
<a href="{{ . }}" class="link-transition gitlab link dib z-999 pt3 pt0-l mr2" title="Gitlab link">
{{ partial "svg/gitlab.svg" (dict "size" $icon_size) }}
</a>
<a href="{{ . }}" target="_blank" class="link-transition gitlab link dib z-999 pt3 pt0-l mr1" title="Gitlab link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/gitlab.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}
{{ with .Param "medium" }}
<a href="{{ . }}" target="_blank" class="link-transition medium link dib z-999 pt3 pt0-l mr1" title="Medium link" rel="noopener" aria-describedby="new-window-0">
{{ partial "svg/medium.svg" (dict "size" $icon_size) }}
{{- partial "new-window-icon.html" . -}}
</a>
{{ end }}

+ 3
- 0
layouts/partials/svg/medium.svg View File

@@ -0,0 +1,3 @@
<svg {{ with .size }} height="{{ . }}" {{ end }} style="enable-background:new 0 0 170 170;" version="1.1" viewBox="0 0 170 170" width="{{ .size }}" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M46.5340803,65.2157554 C46.6968378,63.6076572 46.0836,62.018231 44.8828198,60.93592 L32.6512605,46.2010582 L32.6512605,44 L70.6302521,44 L99.9859944,108.380952 L125.794585,44 L162,44 L162,46.2010582 L151.542017,56.2281011 C150.640424,56.9153477 150.193188,58.0448862 150.380019,59.1628454 L150.380019,132.837155 C150.193188,133.955114 150.640424,135.084652 151.542017,135.771899 L161.755369,145.798942 L161.755369,148 L110.38282,148 L110.38282,145.798942 L120.963119,135.527337 C122.002801,134.487948 122.002801,134.182246 122.002801,132.592593 L122.002801,73.0417402 L92.585901,147.755438 L88.6106443,147.755438 L54.3622782,73.0417402 L54.3622782,123.115814 C54.0767278,125.221069 54.7759199,127.3406 56.2581699,128.863022 L70.0186741,145.55438 L70.0186741,147.755438 L31,147.755438 L31,145.55438 L44.7605042,128.863022 C46.2319621,127.338076 46.8903838,125.204485 46.5340803,123.115814 L46.5340803,65.2157554 Z" style="fill-rule:evenodd;clip-rule:evenodd;fill:{{ .fill }};"/>
</svg>

+ 3
- 0
layouts/partials/svg/new-window.svg View File

@@ -0,0 +1,3 @@
<svg {{ with .size }} height="{{ . }}" {{ end }} style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000" width="{{ .size }}" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;fill:{{ .fill }};"/>
</svg>

+ 15
- 1
src/css/_social-icons.css View File

@@ -1,6 +1,16 @@
.facebook, .twitter, .instagram, .youtube, .github, .gitlab, .linkedin {
.facebook, .twitter, .instagram, .youtube, .github, .gitlab, .linkedin, .medium {
fill: #BABABA;
}

.new-window {
opacity: 0;
display: inline-block;
vertical-align: top;
}
.link-transition:hover .new-window{
opacity: 1;
}

.facebook:hover {
fill: #3b5998;
}
@@ -28,3 +38,7 @@
.linkedin:hover {
fill: #0077b5
}

.medium:hover {
fill: #0077b5
}

+ 5947
- 0
static/dist/css/app.955516233bcafa4d2a1c13cea63c7b50.css
File diff suppressed because it is too large
View File


+ 0
- 3
static/dist/css/app.e08a958ae3e530145318b6373195c765.css
File diff suppressed because it is too large
View File


+ 89
- 1
static/dist/js/app.3fc0f988d21662902933.js View File

@@ -1 +1,89 @@
!function(n){function t(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return n[e].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};t.m=n,t.c=r,t.i=function(n){return n},t.d=function(n,r,e){t.o(n,r)||Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:e})},t.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(r,"a",r),r},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=1)}([function(n,t){},function(n,t,r){"use strict";var e=r(0);!function(n){n&&n.__esModule}(e)}]);
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _main = __webpack_require__(0);

var _main2 = _interopRequireDefault(_main);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/***/ })
/******/ ]);

Loading…
Cancel
Save