Skip to content

Commit

Permalink
make hex-icon an element
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Nov 6, 2023
1 parent d50b83b commit b1e8e93
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 74 deletions.
5 changes: 5 additions & 0 deletions _includes/elements/hex-icon.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="hex-icon">
<div class="inner">
{% include {{ include.file }} %}
</div>
</div>
36 changes: 6 additions & 30 deletions _pages/learning/crystal_programming.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,41 +46,17 @@
</div>

<div class="image-list">
<div class="hex-icon">
<div class="inner">
{% include icons/merge-type.svg %}
</div>
</div>
{% include elements/hex-icon.html file='icons/merge-type.svg' %}
<div class="small">Explore how Crystal combines the merits of other languages</div>
<div class="hex-icon">
<div class="inner">
{% include icons/folder.svg %}
</div>
</div>
{% include elements/hex-icon.html file='icons/folder.svg' %}
<div class="small">Understand how to leverage existing C libraries without writing any C</div>
<div class="hex-icon">
<div class="inner">
{% include icons/update.svg %}
</div>
</div>
{% include elements/hex-icon.html file='icons/update.svg' %}
<div class="small">Focus on zero-cost abstractions with compile-time macros</div>
<div class="hex-icon">
<div class="inner">
{% include icons/code.svg %}
</div>
</div>
{% include elements/hex-icon.html file='icons/code.svg' %}
<div class="small">Use an example-based approach to demonstrate language features</div>
<div class="hex-icon">
<div class="inner">
{% include icons/apps.svg %}
</div>
</div>
{% include elements/hex-icon.html file='icons/apps.svg' %}
<div class="small">Develop a variety of Crystal applications, such as web and CLI apps</div>
<div class="hex-icon">
<div class="inner">
{% include icons/library-books.svg %}
</div>
</div>
{% include elements/hex-icon.html file='icons/library-books.svg' %}
<div class="small">Gain an understanding of the macro API and annotations</div>
</div>

Expand Down
43 changes: 43 additions & 0 deletions _sass/elements/_hex-icon.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
:root {
--sin-60: 0.866;
}

.hex-icon {
--icon-height: 48px;

width: calc(var(--icon-height) * var(--sin-60));
height: var(--icon-height);
display: inline-block;
margin-right: 12px;
position: relative;

filter: drop-shadow(0 0 2px rgba(0,0,0,0.1))
drop-shadow(0 1px 1px rgba(0,0,0,0.2))
drop-shadow(0 1px 1px rgba(0,0,0,0.1));

.inner {
background-color: white;
width: 100%;
height: 100%;

clip-path: polygon(
evenodd,
0% 25%,
0% 75%,
50% 100%,
100% 75%,
100% 25%,
50% 0,
0% 25%
);

& > * {
position: absolute;
width: 24px;
height: 24px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
}
1 change: 1 addition & 0 deletions _sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@import "elements/avatar-list";
@import "elements/color-sample";
@import "elements/hex";
@import "elements/hex-icon";
@import "elements/table";

@import "components/book-authors";
Expand Down
44 changes: 0 additions & 44 deletions _sass/pages/_learning.scss
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
:root {
--sin-60: 0.866;
}

.hex-icon {
--icon-height: 48px;

width: calc(var(--icon-height) * var(--sin-60));
height: var(--icon-height);
display: inline-block;
margin-right: 12px;
position: relative;

filter: drop-shadow(0 0 2px rgba(0,0,0,0.1))
drop-shadow(0 1px 1px rgba(0,0,0,0.2))
drop-shadow(0 1px 1px rgba(0,0,0,0.1));

.inner {
background-color: white;
width: 100%;
height: 100%;

clip-path: polygon(
evenodd,
0% 25%,
0% 75%,
50% 100%,
100% 75%,
100% 25%,
50% 0,
0% 25%
);

& > * {
position: absolute;
width: 24px;
height: 24px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
}

.image-list {
display: grid;
grid-template-columns: repeat(1, min-content 1fr);
Expand Down
5 changes: 5 additions & 0 deletions _style_guide/elements/hex-icon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Hex Icon
type: elements
---
{% include elements/hex-icon.html file='icons/folder.svg' %}

0 comments on commit b1e8e93

Please sign in to comment.