mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 13:34:06 +03:00
- Added title attributes to links in multiple layout files to improve accessibility and SEO. - Updated the configuration file to add new excluded domains. - Improved the readability and user experience of various sections on the page.
64 lines
2.9 KiB
Plaintext
64 lines
2.9 KiB
Plaintext
<%
|
|
// GitHub Contribute button component
|
|
// variant: 'hero' | 'compact' | 'inline' | 'request'
|
|
// showLabel: boolean - whether to show text label
|
|
// className: string - additional CSS class names
|
|
|
|
const variant = locals.variant || 'request';
|
|
const showLabel = locals.showLabel !== false; // show label by default
|
|
const className = locals.className || '';
|
|
|
|
// Set styles based on variant
|
|
const buttonBaseClass = {
|
|
hero: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg',
|
|
compact: 'group inline-flex items-center justify-center h-9 px-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-colors duration-200',
|
|
inline: 'group inline-flex items-center justify-center h-9 px-4 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-200 hover:scale-105',
|
|
request: 'group inline-flex items-center justify-center px-6 py-3 backdrop-blur-sm outline outline-1 rounded-3xl transition-all duration-300 hover:scale-105 hover:shadow-lg'
|
|
}[variant];
|
|
|
|
// GitHub button styles
|
|
const githubClass = {
|
|
hero: 'bg-white/10 outline-white/20 text-white hover:bg-white/20',
|
|
compact: is_home() ? 'bg-white/10 outline-white/20 text-white hover:bg-white/20' : 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700',
|
|
inline: 'bg-white outline-slate-200 dark:bg-slate-800 dark:outline-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700',
|
|
request: 'bg-slate-800/80 outline-slate-700/50 text-white hover:bg-slate-700/90 dark:bg-white/10 dark:outline-white/20 dark:text-white dark:hover:bg-white/20'
|
|
}[variant];
|
|
|
|
// Icon size and styles
|
|
const iconClass = {
|
|
hero: 'w-5 h-5 flex-shrink-0 flex items-center justify-center',
|
|
compact: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',
|
|
inline: 'w-4 h-4 flex-shrink-0 flex items-center justify-center',
|
|
request: 'w-5 h-5 flex-shrink-0 flex items-center justify-center'
|
|
}[variant];
|
|
|
|
// Text size
|
|
const textSize = {
|
|
hero: 'font-semibold leading-none',
|
|
compact: 'text-sm font-medium leading-none',
|
|
inline: 'text-sm font-medium leading-none',
|
|
request: 'font-semibold leading-none'
|
|
}[variant];
|
|
|
|
// Spacing
|
|
const spacing = {
|
|
hero: 'mr-3',
|
|
compact: 'mr-2',
|
|
inline: 'mr-2',
|
|
request: 'mr-3'
|
|
}[variant];
|
|
%>
|
|
|
|
<a href="<%- contributing() %>" target="_blank" rel="noopener noreferrer" title="Contribute on GitHub"
|
|
class="<%= className %>">
|
|
<button type="button" class="<%= buttonBaseClass %> <%= githubClass %>">
|
|
<div class="<%= iconClass %> <%= spacing %>">
|
|
<%- icon("github") %>
|
|
</div>
|
|
<% if (showLabel) { %>
|
|
<span class="<%= textSize %>">
|
|
<% if (variant === 'compact') { %>Contribute<% } else { %>Contribute on GitHub<% } %>
|
|
</span>
|
|
<% } %>
|
|
</button>
|
|
</a> |