Add site info and avatar display options to repo card

Introduces options to show site information and owner avatar in the repository card, including avatar size selection. Updates PHP, JS, and CSS to support new UI elements, avatar caching, and cache clearing via AJAX. Enhances visual presentation and user customization for embedded repository cards.
This commit is contained in:
feibisi 2025-07-31 14:45:54 +08:00
parent 105d769c7f
commit 0c4746d0d3
3 changed files with 392 additions and 18 deletions

160
style.css
View file

@ -58,13 +58,108 @@
border: none;
}
.git-embed-header {
.git-embed-site-info {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid #e1e4e8;
}
.git-embed-site-favicon {
width: 16px;
height: 16px;
flex-shrink: 0;
}
.git-embed-site-name {
font-size: 12px;
color: #656d76;
font-weight: 500;
}
.git-embed-site-name a {
color: #656d76;
text-decoration: none;
}
.git-embed-site-name a:hover {
color: #0969da;
text-decoration: underline;
}
.git-embed-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 12px;
flex-wrap: wrap;
gap: 12px;
}
.git-embed-title-section {
display: flex;
align-items: flex-start;
gap: 12px;
flex: 1;
min-width: 0;
}
.git-embed-title-content {
flex: 1;
min-width: 0;
}
.git-embed-avatar {
border-radius: 50%;
flex-shrink: 0;
border: 2px solid #e1e4e8;
}
.git-embed-avatar-small {
width: 32px;
height: 32px;
}
.git-embed-avatar-medium {
width: 40px;
height: 40px;
}
.git-embed-avatar-large {
width: 48px;
height: 48px;
}
.git-embed-owner-info {
display: flex;
align-items: center;
gap: 8px;
margin-top: 4px;
font-size: 12px;
}
.git-embed-owner-type {
background: #f1f8ff;
color: #0969da;
padding: 2px 6px;
border-radius: 12px;
font-size: 10px;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.git-embed-owner-link {
color: #656d76;
text-decoration: none;
font-weight: 500;
}
.git-embed-owner-link:hover {
color: #0969da;
text-decoration: underline;
}
.git-embed-title {
@ -299,9 +394,35 @@
padding: 16px;
}
.git-embed-site-info {
margin-bottom: 12px;
padding-bottom: 8px;
}
.git-embed-title-section {
gap: 8px;
}
.git-embed-avatar-large {
width: 40px;
height: 40px;
}
.git-embed-avatar-medium {
width: 32px;
height: 32px;
}
.git-embed-owner-info {
flex-direction: column;
align-items: flex-start;
gap: 4px;
}
.git-embed-header {
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
.git-embed-stats {
@ -332,6 +453,19 @@
font-size: 16px;
}
.git-embed-title-section {
flex-direction: column;
gap: 8px;
}
.git-embed-avatar {
align-self: flex-start;
}
.git-embed-owner-info {
margin-top: 0;
}
.git-embed-actions {
flex-direction: column;
}
@ -345,6 +479,10 @@
text-align: center;
gap: 2px;
}
.git-embed-site-info {
justify-content: center;
}
}
.wp-block[data-type="git-embed-feicode/repository"] {
@ -365,4 +503,24 @@
.components-panel__body .components-select-control:disabled {
opacity: 0.3;
}
.git-embed-card img {
max-width: 100%;
height: auto;
}
.git-embed-site-favicon,
.git-embed-avatar {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
.git-embed-card .git-embed-avatar:hover {
transform: scale(1.05);
transition: transform 0.2s ease-in-out;
}
.git-embed-owner-type:empty {
display: none;
}