hexo-theme-amane/layout/widget/profile.ejs

95 lines
3.9 KiB
Plaintext

<% function avatar() {
const avatar = get_config_from_obj(widget, 'avatar');
const gravatar_email = get_config_from_obj(widget, 'gravatar');
if (gravatar_email !== null) {
return gravatar(gravatar_email, 128);
}
if (avatar !== null) {
return url_for(avatar)
}
return url_for('images/avatar.png');
} %>
<div class="card widget">
<div class="card-content">
<nav class="level">
<div class="level-item has-text-centered" style="flex-shrink: 1">
<div>
<% const is_rounded = get_config_from_obj(widget, 'avatar_rounded', false); %>
<figure class="image is-128x128 has-mb-6">
<img class="<%= is_rounded ? 'is-rounded' : '' %>" src="<%= avatar() %>" alt="<%= get_config_from_obj(widget, 'author') %>">
</figure>
<% if (get_config_from_obj(widget, 'author')) { %>
<p class="is-size-4 is-block">
<%= get_config_from_obj(widget, 'author') %>
</p>
<% } %>
<% if (get_config_from_obj(widget, 'author_title')) { %>
<p class="is-size-6 is-block">
<%= get_config_from_obj(widget, 'author_title') %>
</p>
<% } %>
<% if (get_config_from_obj(widget, 'location')) { %>
<p class="is-size-6 is-flex is-flex-center has-text-grey">
<i class="fas fa-map-marker-alt has-mr-7"></i>
<span><%= get_config_from_obj(widget, 'location') %></span>
</p>
<% } %>
</div>
</div>
</nav>
<nav class="level is-mobile">
<div class="level-item has-text-centered is-marginless">
<div>
<p class="heading">
<%= _p('common.post', post_count()) %>
</p>
<p class="title has-text-weight-normal">
<%= post_count() %>
</p>
</div>
</div>
<div class="level-item has-text-centered is-marginless">
<div>
<p class="heading">
<%= _p('common.category', category_count()) %>
</p>
<p class="title has-text-weight-normal">
<%= category_count() %>
</p>
</div>
</div>
<div class="level-item has-text-centered is-marginless">
<div>
<p class="heading">
<%= _p('common.tag', tag_count()) %>
</p>
<p class="title has-text-weight-normal">
<%= tag_count() %>
</p>
</div>
</div>
</nav>
<% if (widget.follow_link) { %>
<div class="level">
<a class="level-item button is-link is-rounded" href="<%= url_for(widget.follow_link) %>" target="_blank">
<%= __('widget.follow') %></a>
</div>
<% } %>
<% const socialLinks = get_config_from_obj(widget, 'social_links'); %>
<% if (socialLinks !== null) { %>
<div class="level is-mobile">
<% for (let name in socialLinks) {
let link = socialLinks[name]; %>
<a class="level-item button is-white is-marginless" target="_blank"
title="<%= name %>" href="<%= url_for(typeof(link) === 'string' ? link : link.url) %>">
<% if (typeof(link) === 'string') { %>
<%= name %>
<% } else { %>
<i class="<%= link.icon %>"></i>
<% } %>
</a>
<% } %>
</div>
<% } %>
</div>
</div>