Skip to content

Commit abd0db3

Browse files
committed
Add external link indicator to project cards / tweak header layout
1 parent b4d70ce commit abd0db3

File tree

2 files changed

+50
-13
lines changed

2 files changed

+50
-13
lines changed

assets/_sass/component/_card.scss

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ $card-padding-lg: rem-calc(20px);
3434
.card {
3535
position: relative;
3636
border: 1px solid $slate-300;
37-
overflow: hidden;
3837
@extend .rounded;
3938
transition: all .2s ease;
4039
transition-property: border-color, box-shadow;
@@ -55,27 +54,58 @@ $card-padding-lg: rem-calc(20px);
5554
}
5655
}
5756

57+
.card__body {
58+
border-color: var(--theme-border-color);
59+
}
60+
5861
.card__header {
59-
width: 100%;
62+
margin: -1px; // offset card border
6063
background-color: var(--theme-primary-color);
61-
border-bottom: 1px solid $slate-300;
64+
border: 1px solid var(--theme-border-color);
65+
border-radius: 6px 6px 0 0;
66+
67+
@media (min-width: $bp-lg) {
68+
display: flex;
69+
flex-direction: column;
70+
justify-content: flex-end;
71+
min-height: 6.7em; // accommodate two lines titles while being equal height
72+
}
6273
}
6374

6475
.card__header,
6576
.card__header-link {
6677
color: var(--theme-text-color);
6778
}
6879

80+
.card__external-indicator {
81+
position: absolute;
82+
top: -1px;
83+
right: -1px;
84+
width: 1.75em;
85+
text-align: center;
86+
background-color: var(--theme-secondary-color);
87+
border-radius: 0 6px 0 6px;
88+
visibility: hidden;
89+
opacity: 0;
90+
transition: opacity .2s ease;
91+
}
92+
93+
.card:hover .card__external-indicator {
94+
visibility: visible;
95+
opacity: 1;
96+
}
97+
6998
.card__header-title {
70-
padding-top: 1em;
99+
margin-bottom: .1em;
71100
font-size: rem-calc(18px);
101+
line-height: 1.2;
72102

73-
@media (min-width: $bp-md) {
103+
@media (min-width: $bp-lg) {
74104
font-size: rem-calc(22px);
75105
}
76106
}
77107

78-
.card__header .svg-icon {
108+
.card__header-list .svg-icon {
79109
margin-right: rem-calc(4px);
80110
opacity: .6;
81111
}

projects.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,39 @@ <h2>Open Source Projects</h2>
2020
<!-- See include below for logic and color.scss for available themes -->
2121
{% include project-color-logic.html %}
2222

23-
<li class="card theme-{{ theme | default: "white" }}">
23+
<li class="card theme-{{ theme | default: "midnight" }}">
2424
<header class="card__header">
2525

2626
<!-- Project title -->
27-
<h2 class="card__header-title m-0">
28-
<a class="card__header-link stretched-link" href='{{ repository.html_url }}'>{{ repository.name }}</a>
27+
<h2 class="card__header-title">
28+
<a class="card__header-link stretched-link" href='{{ repository.html_url }}'>
29+
{{ repository.name }}
30+
</a>
2931
</h2>
3032

3133
<!-- Project metadata -->
32-
<ul class="list--inline fs-md monospace">
34+
<ul class="card__header-list list--inline fs-md monospace">
3335
{% if repository.language %}
3436
<li>
35-
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icons.svg#code' | relative_url }}"></use></svg><span class="visually-hidden">Language: </span>{{ repository.language }}
37+
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icon-sprite.svg#code' | relative_url }}"></use></svg><span class="visually-hidden">Language: </span>{{ repository.language }}
3638
</li>
3739
{% endif %}
3840

3941
{% if repository.license.spdx_id %}
4042
<li>
41-
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icons.svg#license' | relative_url }}"></use></svg><span class="visually-hidden">License: </span>{{ repository.license.spdx_id }}
43+
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icon-sprite.svg#license' | relative_url }}"></use></svg><span class="visually-hidden">License: </span>{{ repository.license.spdx_id }}
4244
</li>
4345
{% endif %}
4446
</ul>
47+
48+
<!-- External Link Indicator -->
49+
<div class="card__external-indicator">
50+
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icon-sprite.svg#arrow-external' | relative_url }}"></use></svg>
51+
</div>
4552
</header>
4653

4754
<!-- Project description -->
48-
<div class="card__body fs-md monospace">
55+
<div class="card__body fs-md monospace" aria-hidden="true">
4956
{% if repository.description %}
5057
<p class="m-0 clamp-3">{{ repository.description }}</p>
5158
{% endif %}

0 commit comments

Comments
 (0)