summaryrefslogtreecommitdiff
path: root/symbol
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2017-09-22 08:39:47 +0000
committerPhil Hughes <me@iamphill.com>2017-09-22 08:39:47 +0000
commit55f772bb98a67ad346442a2cacb5646f6719b987 (patch)
treefdcda42d5ee9c746b5654a50fa88a0fd1464d3a8 /symbol
parentd103e95513704314a38ab8ae441851524031c4a1 (diff)
downloadgitlab-ce-55f772bb98a67ad346442a2cacb5646f6719b987.tar.gz
Resolve "Better SVG Usage in the Frontend"
Diffstat (limited to 'symbol')
-rw-r--r--symbol/icons.svg1
-rw-r--r--symbol/sprite.symbol.html177
2 files changed, 178 insertions, 0 deletions
diff --git a/symbol/icons.svg b/symbol/icons.svg
new file mode 100644
index 00000000000..433bd2aca0d
--- /dev/null
+++ b/symbol/icons.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol viewBox="0 0 1792 1792" id="clock_o" xmlns="http://www.w3.org/2000/svg"><path d="M1024 544v448q0 14-9 23t-23 9H672q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h224V544q0-14 9-23t23-9h64q14 0 23 9t9 23zm416 352q0-148-73-273t-198-198-273-73-273 73-198 198-73 273 73 273 198 198 273 73 273-73 198-198 73-273zm224 0q0 209-103 385.5T1281.5 1561 896 1664t-385.5-103T231 1281.5 128 896t103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"/></symbol><symbol viewBox="0 0 36 18" id="commit" xmlns="http://www.w3.org/2000/svg"><path d="M34 7h-7.2c-.9-4-4.5-7-8.8-7s-7.9 3-8.8 7H2C.9 7 0 7.9 0 9s.9 2 2 2h7.2c.9 4 4.5 7 8.8 7s7.9-3 8.8-7H34c1.1 0 2-.9 2-2s-.9-2-2-2m-16 7c-2.8 0-5-2.2-5-5s2.2-5 5-5 5 2.2 5 5-2.2 5-5 5"/></symbol><symbol viewBox="0 0 16 16" id="project" xmlns="http://www.w3.org/2000/svg"><path d="M8.462 2.177l-.038.044a.505.505 0 0 0 .038-.044zm-.787 0a.5.5 0 0 0 .038.043l-.038-.043zM3.706 7h8.725L8.069 2.585 3.706 7zM7 13.369V12a1 1 0 0 1 2 0v1.369h3V9H4v4.369h3zM14 9v4.836c0 .833-.657 1.533-1.5 1.533h-9c-.843 0-1.5-.7-1.5-1.533V9h-.448a1.1 1.1 0 0 1-.783-1.873L6.934.887a1.5 1.5 0 0 1 2.269 0l6.165 6.24A1.1 1.1 0 0 1 14.585 9H14z"/></symbol></svg> \ No newline at end of file
diff --git a/symbol/sprite.symbol.html b/symbol/sprite.symbol.html
new file mode 100644
index 00000000000..a2289014093
--- /dev/null
+++ b/symbol/sprite.symbol.html
@@ -0,0 +1,177 @@
+<!DOCTYPE html>
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta charset="utf-8"/>
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
+ <script src="https://rawgit.com/jonathantneal/svg4everybody/master/dist/svg4everybody.js"></script>
+ <script>svg4everybody();</script>
+ <title>SVG &lt;symbol&gt; sprite preview | svg-sprite</title>
+ <style>@charset "UTF-8";body{padding:0;margin:0;color:#666;background:#fafafa;font-family:Arial,Helvetica,sans-serif;font-size:1em;line-height:1.4}header{display:block;padding:3em 3em 2em 3em;background-color:#fff}header p{margin:2em 0 0 0}section{border-top:1px solid #eee;padding:2em 3em 0 3em}section ul{margin:0;padding:0}section li{display:inline;display:inline-block;background-color:#fff;position:relative;margin:0 2em 2em 0;vertical-align:top;border:1px solid #ccc;padding:1em 1em 3em 1em;cursor:default}.icon-box{margin:0;width:144px;height:144px;position:relative;background:#ccc url("data:image/gif;base64,R0lGODlhDAAMAIAAAMzMzP///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0Y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KuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAAwADAAAAhaEH6mHmmzcgzJAUG/NVGrfOZ8YLlABADs=") top left repeat;border:1px solid #ccc;display:table-cell;vertical-align:middle;text-align:center}.icon{display:inline;display:inline-block}h1{margin-top:0}h2{margin:0;padding:0;font-size:1em;font-weight:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:absolute;left:1em;right:1em;bottom:1em}footer{display:block;margin:0;padding:0 3em 3em 3em}footer p{margin:0;font-size:.7em}footer a{color:#0f7595;margin-left:0}</style>
+
+<!--
+
+Sprite shape dimensions
+====================================================================================================
+You will need to set the sprite shape dimensions via CSS when you use them as inline SVG, otherwise
+they would become a huge 100% in size. You may use the following dimension classes for doing so.
+They might well be outsourced to an external stylesheet of course.
+
+-->
+
+<style type="text/css">
+ .svg-clock_o-dims { width: 200px; height: 200px; }
+ .svg-commit-dims { width: 36px; height: 18px; }
+ .svg-project-dims { width: 16px; height: 16px; }
+</style>
+<!--
+====================================================================================================
+-->
+
+ </head>
+ <body>
+
+<!--
+
+Inline <symbol> SVG sprite
+====================================================================================================
+This is an inlined version of the generated SVG sprite. The single images may be <use>d everywhere
+below within this document. Please see
+
+ https://github.com/jkphl/svg-sprite/blob/master/docs/configuration.md#defs--symbol-mode
+
+for further details on how to create this embeddable sprite variant.
+
+-->
+
+<svg width="0" height="0" style="position:absolute">
+ <symbol viewBox="0 0 1792 1792" id="clock_o" xmlns="http://www.w3.org/2000/svg"><path d="M1024 544v448q0 14-9 23t-23 9H672q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h224V544q0-14 9-23t23-9h64q14 0 23 9t9 23zm416 352q0-148-73-273t-198-198-273-73-273 73-198 198-73 273 73 273 198 198 273 73 273-73 198-198 73-273zm224 0q0 209-103 385.5T1281.5 1561 896 1664t-385.5-103T231 1281.5 128 896t103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"/></symbol>
+ <symbol viewBox="0 0 36 18" id="commit" xmlns="http://www.w3.org/2000/svg"><path d="M34 7h-7.2c-.9-4-4.5-7-8.8-7s-7.9 3-8.8 7H2C.9 7 0 7.9 0 9s.9 2 2 2h7.2c.9 4 4.5 7 8.8 7s7.9-3 8.8-7H34c1.1 0 2-.9 2-2s-.9-2-2-2m-16 7c-2.8 0-5-2.2-5-5s2.2-5 5-5 5 2.2 5 5-2.2 5-5 5"/></symbol>
+ <symbol viewBox="0 0 16 16" id="project" xmlns="http://www.w3.org/2000/svg"><path d="M8.462 2.177l-.038.044a.505.505 0 0 0 .038-.044zm-.787 0a.5.5 0 0 0 .038.043l-.038-.043zM3.706 7h8.725L8.069 2.585 3.706 7zM7 13.369V12a1 1 0 0 1 2 0v1.369h3V9H4v4.369h3zM14 9v4.836c0 .833-.657 1.533-1.5 1.533h-9c-.843 0-1.5-.7-1.5-1.533V9h-.448a1.1 1.1 0 0 1-.783-1.873L6.934.887a1.5 1.5 0 0 1 2.269 0l6.165 6.24A1.1 1.1 0 0 1 14.585 9H14z"/></symbol>
+</svg>
+
+<!--
+====================================================================================================
+-->
+
+ <header>
+ <h1>SVG <code>&lt;symbol&gt;</code> sprite preview</h1>
+ <p>This preview features two methods of using the generated sprite in conjunction with inline SVG. Please have a look at the HTML source for further details and be aware of the following constraints:</p>
+ <ul>
+ <li>Your browser has to <a href="http://caniuse.com/#feat=svg-html5" target="_blank">support inline SVG</a> for these techniques to work.</li>
+ <li>The embedded sprite (A) slightly differs from the generated external one. Please <a href="https://github.com/jkphl/svg-sprite/blob/master/docs/configuration.md#defs--symbol-mode" target="_blank">see the documentation</a> for details on how to create such an embeddable sprite.</li>
+ <li>Internet Explorer up to version 11 doesn't support external sprites for use with inline SVG. For IE 9-11, you may polyfill this functionality with <a href="https://github.com/jonathantneal/svg4everybody" target="_blank">SVG for Everybody</a>.</li>
+ </ul>
+ </header>
+ <section>
+
+<!--
+
+A) Inline SVG with embedded sprite
+====================================================================================================
+These SVG images make use of fragment identifiers (IDs) and are extracted out of the inline sprite
+embedded above. They may be styled via CSS.
+
+-->
+
+ <h3>A) Inline SVG with embedded sprite</h3>
+ <ul>
+
+ <li title="clock_o">
+ <div class="icon-box">
+
+ <!-- clock_o -->
+ <svg class="svg-clock_o-dims">
+ <use xlink:href="#clock_o"></use>
+ </svg>
+
+ </div>
+ <h2>clock_o</h2>
+ </li>
+ <li title="commit">
+ <div class="icon-box">
+
+ <!-- commit -->
+ <svg class="svg-commit-dims">
+ <use xlink:href="#commit"></use>
+ </svg>
+
+ </div>
+ <h2>commit</h2>
+ </li>
+ <li title="project">
+ <div class="icon-box">
+
+ <!-- project -->
+ <svg class="svg-project-dims">
+ <use xlink:href="#project"></use>
+ </svg>
+
+ </div>
+ <h2>project</h2>
+ </li>
+ </ul>
+
+<!--
+====================================================================================================
+-->
+
+ </section>
+ <section>
+
+<!--
+
+B) Inline SVG with external sprite (IE 9-11 with polyfill only)
+====================================================================================================
+These SVG images make use of an URL + fragment identifiers (IDs) and refer to the regular external
+SVG sprite. They may be styled via CSS. (IE 9-11 with polyfill only)
+
+-->
+
+ <h3>B) Inline SVG with external sprite (IE 9-11 with polyfill only)</h3>
+ <ul>
+
+ <li title="clock_o">
+ <div class="icon-box">
+
+ <!-- clock_o -->
+ <svg class="svg-clock_o-dims">
+ <use xlink:href="icons.svg#clock_o"></use>
+ </svg>
+
+ </div>
+ <h2>clock_o</h2>
+ </li>
+ <li title="commit">
+ <div class="icon-box">
+
+ <!-- commit -->
+ <svg class="svg-commit-dims">
+ <use xlink:href="icons.svg#commit"></use>
+ </svg>
+
+ </div>
+ <h2>commit</h2>
+ </li>
+ <li title="project">
+ <div class="icon-box">
+
+ <!-- project -->
+ <svg class="svg-project-dims">
+ <use xlink:href="icons.svg#project"></use>
+ </svg>
+
+ </div>
+ <h2>project</h2>
+ </li>
+ </ul>
+
+<!--
+====================================================================================================
+-->
+
+ </section>
+ <footer>
+ <p>Generated at Fri, 25 Aug 2017 12:38:01 GMT by <a href="https://github.com/jkphl/svg-sprite" target="_blank">svg-sprite</a>.</p>
+ </footer>
+ </body>
+</html>