Skip to content

Commit

Permalink
Create Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanalbizu committed Oct 11, 2016
0 parents commit 8a5a518
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Badges with Sass and Svg
76 changes: 76 additions & 0 deletions badge.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Badge</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="box-badge">
<div class="hexagon-draw">
<div class="hexagon-construct-top"></div>
<div class="hexagon-construct-middle"></div>
<div class="hexagon-construct-bottom"></div>
<div class="hexagon-picture">
<img src="img/badge.svg" alt="Title Badge">
</div>
</div>
<div class="hexagon-draw">
<div class="hexagon-construct-top"></div>
<div class="hexagon-construct-middle"></div>
<div class="hexagon-construct-bottom"></div>
<div class="hexagon-picture">
<img src="img/dollar-symbol.svg" alt="Title Dollar Symbol">
</div>
</div>
<div class="hexagon-draw">
<div class="hexagon-construct-top"></div>
<div class="hexagon-construct-middle"></div>
<div class="hexagon-construct-bottom"></div>
<div class="hexagon-picture">
<img src="img/dollar.svg" alt="Title Dollar">
</div>
</div>
<div class="hexagon-draw">
<div class="hexagon-construct-top"></div>
<div class="hexagon-construct-middle"></div>
<div class="hexagon-construct-bottom"></div>
<div class="hexagon-picture">
<img src="img/badge.svg" alt="Title Badge">
</div>
</div>
<div class="hexagon-draw">
<div class="hexagon-construct-top"></div>
<div class="hexagon-construct-middle"></div>
<div class="hexagon-construct-bottom"></div>
<div class="hexagon-picture">
<img src="img/dollar-symbol.svg" alt="Title Dollar Symbol">
</div>
</div>
<div class="hexagon-draw">
<div class="hexagon-construct-top"></div>
<div class="hexagon-construct-middle"></div>
<div class="hexagon-construct-bottom"></div>
<div class="hexagon-picture">
<img src="img/dollar.svg" alt="Title Dollar">
</div>
</div>
</div>
<a href="http://ivanalbizu.eu/">Iván González Albizu</a>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js" type="text/javascript">
</script>
<script type="text/javascript">
if (!Modernizr.svg) {
var imgs = document.getElementsByTagName('img');
var svgExtension = /.*\.svg$/
var l = imgs.length;
for(var i = 0; i < l; i++) {
if(imgs[i].src.match(svgExtension)) {
imgs[i].src = imgs[i].src.slice(0, -3) + 'png';
console.log(imgs[i].src);
}
}
}
</script>
</body>
</html>
33 changes: 33 additions & 0 deletions css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions css/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@mixin badge-generator($width: 94, $color: #ff1744, $margin_top: 0) {
$middle_width: $width/2;
$height: ($width/2) * 1.154700538;
$border_top: $height/2;

text-align: center; //center image
margin-top: unquote( $margin_top + 'px');

.hexagon-draw {
display: inline-block;
margin-right: 10px;

.hexagon-construct-top {
width: 0;
border-bottom: unquote( $border_top + 'px') solid $color;
border-left: unquote( $middle_width + 'px') solid transparent;
border-right: unquote( $middle_width + 'px') solid transparent;
}
.hexagon-construct-middle {
width: unquote( ($width) + 'px');
height: 54px;//width/2*1,154700538
height: unquote( ( ($width/2) * 1.154700538 ) + 'px');
background-color: $color;
}
.hexagon-construct-bottom {
width: 0;
border-top: unquote( $border_top + 'px') solid $color;
border-left: unquote( $middle_width + 'px') solid transparent;
border-right: unquote( $middle_width + 'px') solid transparent;
}
.hexagon-picture {
position: relative;
top: unquote( (-0.83 * $width) + 'px');
height: 0;
img {
max-height: unquote( $middle_width + 'px');
}
}
}
}


body {
background-color: #f3f3f3;
@include badge-generator(90, #ff1744, 200);
}
svg {
fill: ffaa22;
}
1 change: 1 addition & 0 deletions img/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/dollar-symbol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/dollar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sass-svg-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8a5a518

Please sign in to comment.