theme reorx: enhance location display

This commit is contained in:
Reorx 2023-02-14 13:12:51 +08:00
parent 9bf4c10a92
commit 4e2c1f0eca
2 changed files with 10 additions and 3 deletions

View File

@ -4,6 +4,13 @@ function linkInDiv(url) {
return `<div class="url row"><a href="${url}" target="_blank">${fn.noSchemaURL(url)}</a></div>`
}
%>
<%
function formatLocation(loc) {
const cityToCountry = ['city', 'postalCode', 'region', 'countryCode'].map(key => loc[key]).filter(v => v).join(', ')
if (!loc.address) return cityToCountry
return `${loc.address}. ${cityToCountry}`
}
%>
<!-- Basics -->
<section class="basics-section">
@ -36,7 +43,7 @@ function linkInDiv(url) {
<% if (cv.basics.location) { %>
<div class="item">
<%- fn.getIconSVG('mdi:location') %>
<span><%= cv.basics.location.city %>, <%= cv.basics.location.countryCode %></span>
<span><%= formatLocation(cv.basics.location) %></span>
</div>
<% } %>
</div>

View File

@ -165,14 +165,14 @@ section {
.contact {
color: $color-text-dim;
display: flex;
flex-wrap: wrap;
gap: .4em 1em;
@media screen and (max-width: 500px) {
flex-direction: column;
gap: .4em;
}
.item {
margin-right: 1em;
a {
color: $color-text-dim;
}