|
69 | 69 | x-transition:leave-start="transform opacity-100 scale-100" |
70 | 70 | x-transition:leave-end="transform opacity-0 scale-95" |
71 | 71 | class="absolute right-0 z-30 w-full mt-2 origin-top-right md:max-w-sm md:w-screen"> |
72 | | - <div class="px-2 pt-2 pb-4 bg-white rounded-md shadow-lg text-zinc-900"> |
| 72 | + <div class="px-2 pt-2 pb-2 bg-white rounded-md shadow-lg text-zinc-900"> |
73 | 73 | <div class="grid grid-cols-1 gap-4"> |
74 | 74 | {{ range (index site.Menus .Identifier) }} |
75 | 75 | <a class="flex items-start p-2 bg-transparent rounded-lg group row hover:text-white focus:text-white hover:bg-primary-600 focus:bg-primary-700 focus:outline-none focus:shadow-outline" |
76 | | - href="{{ .URL | absLangURL }}"> |
77 | | - <div class="p-3 text-white bg-primary-600 rounded-lg group-hover:bg-gray-900"> |
78 | | - {{ if (eq .Pre "stars") }} |
79 | | - <svg fill="none" stroke="currentColor" stroke-linecap="round" |
80 | | - stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" |
81 | | - class="w-4 h-4 md:h-6 md:w-6"> |
82 | | - <path |
83 | | - d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"> |
84 | | - </path> |
85 | | - </svg> |
86 | | - {{ else if (eq .Pre "comments") }} |
87 | | - <svg fill="none" stroke="currentColor" stroke-linecap="round" |
88 | | - stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" |
89 | | - class="w-4 h-4 md:h-6 md:w-6"> |
90 | | - <path |
91 | | - d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"> |
92 | | - </path> |
93 | | - </svg> |
| 76 | + href="{{ .URL | absLangURL }}" target="_blank"> |
| 77 | + {{ if or (hasPrefix .Pre "/") (hasPrefix .Pre ".") }} |
| 78 | + <div class="text-white bg-primary-600 rounded-lg group-hover:bg-gray-900 h-12 w-12"> |
| 79 | + {{ with resources.Get .Pre }} |
| 80 | + {{ $postimage := (.Resize "48x webp q90").RelPermalink }} |
| 81 | + <img src="{{ $postimage }}" class="object-cover overflow-hidden rounded-t-lg" |
| 82 | + loading="lazy" alt="{{ $.Title }}" /> |
94 | 83 | {{ else }} |
95 | | - <svg fill="none" stroke="currentColor" stroke-linecap="round" |
96 | | - stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" |
97 | | - class="w-4 h-4 md:h-6 md:w-6"> |
98 | | - <path d="M11 3.055A9.001 9.001 0 1020.945 13H11V3.055z"> |
99 | | - </path> |
100 | | - <path d="M20.488 9H15V3.512A9.025 9.025 0 0120.488 9z"> |
101 | | - </path> |
102 | | - </svg> |
| 84 | + <!-- Fallback if the resource is not found --> |
| 85 | + <p>Image not found.</p> |
103 | 86 | {{ end }} |
104 | | - |
105 | | - </div> |
| 87 | + </div> |
| 88 | + {{ else }} |
| 89 | + <div class="p-3 text-white bg-primary-600 rounded-lg group-hover:bg-gray-900 h-12 w-12"> |
| 90 | + {{ if (eq .Pre "stars") }} |
| 91 | + <svg fill="none" stroke="currentColor" stroke-linecap="round" |
| 92 | + stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" |
| 93 | + class="w-4 h-4 md:h-6 md:w-6"> |
| 94 | + <path |
| 95 | + d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"> |
| 96 | + </path> |
| 97 | + </svg> |
| 98 | + {{ else if (eq .Pre "comments") }} |
| 99 | + <svg fill="none" stroke="currentColor" stroke-linecap="round" |
| 100 | + stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" |
| 101 | + class="w-4 h-4 md:h-6 md:w-6"> |
| 102 | + <path |
| 103 | + d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"> |
| 104 | + </path> |
| 105 | + </svg> |
| 106 | + {{ else }} |
| 107 | + <svg fill="none" stroke="currentColor" stroke-linecap="round" |
| 108 | + stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" |
| 109 | + class="w-4 h-4 md:h-6 md:w-6"> |
| 110 | + <path d="M11 3.055A9.001 9.001 0 1020.945 13H11V3.055z"> |
| 111 | + </path> |
| 112 | + <path d="M20.488 9H15V3.512A9.025 9.025 0 0120.488 9z"> |
| 113 | + </path> |
| 114 | + </svg> |
| 115 | + {{ end }} |
| 116 | + |
| 117 | + </div> |
| 118 | + {{ end }} |
106 | 119 | <div class="ml-3"> |
107 | 120 | <p class="font-semibold">{{ .Name }}</p> |
108 | 121 | <p class="text-sm">{{ .Post }}</p> |
|
0 commit comments