Skip to content

Commit

Permalink
move image-list into a component
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Nov 6, 2023
1 parent dd3612c commit bc99c63
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 42 deletions.
8 changes: 8 additions & 0 deletions _includes/components/image-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="image-list">
{% for item in include.items %}
{% include elements/hex-icon.html file=item.image %}
<div class="small">
{{ item.description }}
</div>
{% endfor %}
</div>
31 changes: 15 additions & 16 deletions _pages/learning/crystal_programming.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
title: "Building efficient, safe, and readable web and CLI applications with Crystal"
layout: wide

what_you_will_learn:
- image: icons/merge-type.svg
description: Explore how Crystal combines the merits of other languages
- image: icons/folder.svg
description: Understand how to leverage existing C libraries without writing any C
- image: icons/update.svg
description: Focus on zero-cost abstractions with compile-time macros
- image: icons/code.svg
description: Use an example-based approach to demonstrate language features
- image: icons/apps.svg
description: Develop a variety of Crystal applications, such as web and CLI apps
- image: icons/library-books.svg
description: Gain an understanding of the macro API and annotations

authors:
- image: /assets/learning/george.png
description: |
Expand Down Expand Up @@ -58,22 +72,7 @@
<span>What you will learn</span>
</div>
</div>

<div class="image-list">
{% include elements/hex-icon.html file='icons/merge-type.svg' %}
<div class="small">Explore how Crystal combines the merits of other languages</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>
{% include elements/hex-icon.html file='icons/update.svg' %}
<div class="small">Focus on zero-cost abstractions with compile-time macros</div>
{% include elements/hex-icon.html file='icons/code.svg' %}
<div class="small">Use an example-based approach to demonstrate language features</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>
{% include elements/hex-icon.html file='icons/library-books.svg' %}
<div class="small">Gain an understanding of the macro API and annotations</div>
</div>

{% include components/image-list.html items=page.what_you_will_learn %}
<div class="full-width-rule">
</div>
</section>
Expand Down
25 changes: 25 additions & 0 deletions _sass/components/_image-list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.image-list {
display: grid;
grid-template-columns: repeat(1, min-content 1fr);
align-items: center;
row-gap: 20px;

.small {
font-size: 85%;
margin-right: var(--padding-lg);
}
}

@media (min-width: 35em) {
.image-list {
row-gap: 40px;
grid-template-columns: repeat(2, min-content 1fr);
}
}

@media (min-width: 55em) {
.image-list {
row-gap: 60px;
grid-template-columns: repeat(3, min-content 1fr);
}
}
1 change: 1 addition & 0 deletions _sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@import "components/cards-list";
@import "components/profile-card";
@import "components/content";
@import "components/image-list";
@import "components/link-item";
@import "components/navbar";
@import "components/post-teaser";
Expand Down
26 changes: 0 additions & 26 deletions _sass/pages/_learning.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
.image-list {
display: grid;
grid-template-columns: repeat(1, min-content 1fr);
align-items: center;
row-gap: 20px;

.small {
font-size: 85%;
margin-right: var(--padding-lg);
}
}

@media (min-width: 35em) {
.image-list {
row-gap: 40px;
grid-template-columns: repeat(2, min-content 1fr);
}
}

@media (min-width: 55em) {
.image-list {
row-gap: 60px;
grid-template-columns: repeat(3, min-content 1fr);
}
}

.book-presenter {
font-size: 120%;
display: grid;
Expand Down
12 changes: 12 additions & 0 deletions _style_guide/components/image-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Image List
type: components
module: _includes/components/image-list.html

items:
- image: icons/merge-type.svg
description: Lorem ipsum dolor sit amet consectetur, adipisicing elit
- image: icons/folder.svg
description: Quia quos autem veniam libero!
---
{% include components/image-list.html items=page.items %}

0 comments on commit bc99c63

Please sign in to comment.