Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: friend link overflow #219

Merged
merged 1 commit into from
Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 51 additions & 87 deletions assets/css/_partial/_single/_friend.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
$avatar-border-color: #f0f0f0;
$avatar-border-color-dark: #363636;
$avatar-border-color-black: #363636;

$friend-link-background-color: #f8f8f8;
$friend-link-background-color-dark: #252627;
$friend-link-background-color-black: #111111;
Expand All @@ -14,33 +10,16 @@ $friend-link-hover-color: #ef3982;
$friend-link-hover-color-dark: #ffffff;
$friend-link-hover-color-black: #ffffff;

.friend-link-avatar img {
width: 56px;
height: 56px;
padding: 2px;
margin-top: 14px;
margin-left: 14px;
border-radius: 50%;
border: 1px solid $avatar-border-color;
[theme=dark] & {
border: 1px solid $avatar-border-color-dark;
}
[theme=black] & {
border: 1px solid $avatar-border-color-black;
}
}

.friend-link-div {
height: 92px;
margin-top: 5px;
width: 48%;
display: inline-block !important;
border-radius: 5px;
display: inline-block;
background: $friend-link-background-color;
[theme=dark] & {
[theme="dark"] & {
background: $friend-link-background-color-dark;
}
[theme=black] & {
[theme="black"] & {
background: $friend-link-background-color-black;
}
-webkit-transition: transform 0.4s ease;
Expand All @@ -50,75 +29,60 @@ $friend-link-hover-color-black: #ffffff;
&:hover {
@include transform(scale(1.01));
}
}

.friend-link-avatar {
width: 92px;
float: left;
}

.friend-link-avatar {
margin-right: 2px;
}

.friend-link-info {
margin-top: 18px;
margin-right: 18px;
color: $friend-link-color;
[theme=dark] & {
color: $friend-link-color-dark;
}
[theme=black] & {
color: $friend-link-color-black;
.friend-link-avatar {
width: 92px;
float: left;
height: 100%;
img {
width: 56px;
height: 56px;
margin: 18px;
border-radius: 50%;
}
}
&:hover {
color: $friend-link-hover-color;
[theme=dark] & {
color: $friend-link-hover-color-dark;
.friend-link-info {
margin: 18px 18px 18px 92px;
color: $friend-link-color;
[theme="dark"] & {
color: $friend-link-color-dark;
}
[theme=black] & {
color: $friend-link-hover-color-black;
[theme="black"] & {
color: $friend-link-color-black;
}
&:hover {
color: $friend-link-hover-color;
[theme="dark"] & {
color: $friend-link-hover-color-dark;
}
[theme="black"] & {
color: $friend-link-hover-color-black;
}
}
.friend-name-div {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
.friend-name {
font-style: normal;
}
}
.friend-bio {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
color: $global-font-secondary-color;
[theme="dark"] & {
color: $global-font-secondary-color-dark;
}
[theme="black"] & {
color: $global-font-secondary-color-black;
}
}
}
}

.friend-name {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-style: normal;

}

.friend-bio {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
color: $global-font-secondary-color;
[theme=dark] & {
color: $global-font-secondary-color-dark;
}
[theme=black] & {
color: $global-font-secondary-color-black;
}
}

@media screen and (max-width: 600px) {
.friend-bio {
display: none;
}
.friend-link-avatar {
width: 54px;
margin: auto;
}
.friend-link-info {
height: 100%;
margin: auto;
display: flex;
align-items: center;
justify-content: center;
}
.friend-name {
font-size: 14px;
.friend-link-div {
width: 100%;
}
}
2 changes: 2 additions & 0 deletions exampleSite/content/posts/tests/friend-link-tests/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ hiddenFromSearch: true
{{< friend name="PCloud" url="https://github.com/HEIGE-PCloud/" avatar="https://avatars.githubusercontent.com/u/52968553?v=4" bio="This is PCloud as well~" >}}

{{< friend "PCloud" "https://github.com/HEIGE-PCloud/" "https://avatars.githubusercontent.com/u/52968553?v=4" "Awwwwww, toooooooo many PCloud🤔" >}}

{{< friend "this_is_a_long_long_long_long_name" "https://github.com/HEIGE-PCloud/" "https://avatars.githubusercontent.com/u/52968553?v=4" "this_is_a_long_long_long_long_long_long_long_bio" >}}

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions layouts/shortcodes/friend.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
<a target="_blank" href={{ .Get "url" }} title={{ .Get "name" }} class="friend-link">
<div class="friend-link-div">
<div class="friend-link-avatar">
{{- dict "Src" $avatar "Height" "62" "Width" "62" | partial "plugin/image.html" -}}
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
</div>
<div class="friend-link-info">
<i class="fas fa-user-circle fa-fw"></i>
<i class="friend-name">{{ .Get "name" }}</i>
<div class="friend-name-div">
<i class="fas fa-user-circle fa-fw"></i>
<i class="friend-name">{{ .Get "name" }}</i>
</div>
<p class="friend-bio">{{ .Get "bio" }}</p>
</div>
</div>
Expand All @@ -17,11 +19,13 @@
<a target="_blank" href={{ .Get 1 }} title={{ .Get 0 }} class="friend-link">
<div class="friend-link-div">
<div class="friend-link-avatar">
{{- dict "Src" $avatar "Height" "62" "Width" "62" | partial "plugin/image.html" -}}
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
</div>
<div class="friend-link-info">
<i class="fas fa-user-circle fa-fw"></i>
<i class="friend-name">{{ .Get 0 }}</i>
<div class="friend-name-div">
<i class="fas fa-user-circle fa-fw"></i>
<i class="friend-name">{{ .Get 0 }}</i>
</div>
<p class="friend-bio">{{ .Get 3 }}</p>
</div>
</div>
Expand Down