|
16 | 16 | margin: 0; |
17 | 17 | padding: 0; |
18 | 18 | } |
19 | | -
|
20 | 19 | .project { |
21 | 20 | width: 48%; /* Full width for each project */ |
22 | 21 | padding: 15px; |
|
33 | 32 | flex-direction: column; |
34 | 33 | gap: 10px; |
35 | 34 | } |
36 | | -
|
37 | 35 | .project:hover { |
38 | 36 | cursor: pointer; |
39 | 37 | border-color: #bbb; |
40 | 38 | } |
41 | | -
|
42 | 39 | .project-header { |
43 | 40 | display: flex; |
44 | 41 | align-items: center; |
45 | 42 | justify-content: space-between; |
46 | 43 | margin-bottom: 10px; |
47 | 44 | } |
48 | | -
|
| 45 | + .logo-container { |
| 46 | + width: 120px; |
| 47 | + height: 50px; |
| 48 | + display: flex; |
| 49 | + align-items: center; |
| 50 | + justify-content: flex-end; /* Right align the logo */ |
| 51 | + flex-shrink: 0; /* Prevent logo container from shrinking */ |
| 52 | + margin-left: 10px; /* Add some space between text and logo */ |
| 53 | + } |
49 | 54 | .project-logo { |
50 | | - max-height: 50px; |
| 55 | + max-width: 100%; |
| 56 | + max-height: 100%; |
51 | 57 | object-fit: contain; |
52 | | - margin-right: 2px; |
53 | 58 | } |
54 | 59 |
|
| 60 | + .project-info { |
| 61 | + flex-grow: 1; |
| 62 | + overflow: hidden; /* Prevent text from overflowing */ |
| 63 | + } |
55 | 64 | .project-name { |
56 | 65 | font-size: 20px; |
57 | 66 | font-weight: bold; |
58 | | - flex-grow: 1; |
| 67 | + white-space: nowrap; |
| 68 | + overflow: hidden; |
| 69 | + text-overflow: ellipsis; |
59 | 70 | } |
60 | | -
|
61 | 71 | .project-description { |
62 | 72 | font-size: 14px; |
63 | 73 | } |
64 | | -
|
65 | 74 | .project-details { |
66 | 75 | display: flex; |
67 | 76 | justify-content: flex-start; |
68 | 77 | gap: 20px; /* Add space between details */ |
69 | 78 | font-size: 12px; |
70 | 79 | color: #666; |
71 | 80 | } |
72 | | -
|
73 | 81 | /* Fixed widths for consistent vertical alignment */ |
74 | 82 | .project-details .language { |
75 | 83 | width: 50px; /* Fixed width for language */ |
76 | 84 | } |
77 | | -
|
78 | | - .project-details .stars, .project-details .forks { |
| 85 | + .project-details .stars { |
79 | 86 | width: 30px; /* Fixed width for stars and forks */ |
80 | 87 | } |
81 | | -
|
| 88 | + .project-details .forks { |
| 89 | + width: 30px; /* Fixed width for stars and forks */ |
| 90 | + justify-content: flex-start; |
| 91 | + } |
82 | 92 | .project-details span { |
83 | 93 | display: flex; |
84 | 94 | align-items: center; |
85 | 95 | gap: 5px; |
86 | 96 | justify-content: space-between; |
87 | 97 | } |
88 | | -
|
| 98 | + /* Only change the styles for the fork count text */ |
| 99 | + .project-details .forks span { |
| 100 | + justify-content: flex-start; /* Left-align the text */ |
| 101 | + padding-left: 2px; /* Add a bit of padding */ |
| 102 | + } |
| 103 | + .project-details .forks span span { |
| 104 | + text-align: left; |
| 105 | + } |
89 | 106 | .project-details i { |
90 | 107 | color: #333; |
| 108 | + width: 12px; /* Fixed width for icons */ |
| 109 | + text-align: center; /* Center the icon */ |
91 | 110 | } |
92 | | -
|
93 | 111 | @media (max-width: 800px) { |
94 | 112 | .project { |
95 | 113 | width: calc(100% - 20px); /* Full width on smaller screens */ |
96 | 114 | margin: 0 auto; |
97 | 115 | } |
98 | | -
|
99 | 116 | /* Remove fixed widths on smaller screens for flexibility */ |
100 | 117 | .project-details .language, |
101 | 118 | .project-details .stars, |
|
116 | 133 | {% if section.description %} |
117 | 134 | <p>{{ section.description }}</p> |
118 | 135 | {% endif %} |
119 | | - |
120 | 136 | <div class="project-container"> |
121 | 137 | {% for item in section.items %} |
122 | 138 | <a href="{{ item.url or item.github_url }}" class="project" data-repo="{{ item.github_url }}"> |
123 | 139 | <div class="project-header"> |
124 | | - <span> |
125 | | - <div class="project-name">{{ item.name }}</div> |
126 | | - {% if item.github_url %} |
127 | | - <div class="project-details"> |
128 | | - <!-- Fixed width for consistent alignment, using FontAwesome icons --> |
129 | | - <span class="language"><i class="fas fa-code"></i> <span id="{{ item.name | lower | replace(' ', '-') }}-language">...</span></span> |
130 | | - <span class="stars"><i class="far fa-star"></i> <span id="{{ item.name | lower | replace(' ', '-') }}-stars">...</span></span> |
131 | | - <span class="forks"><i class="fas fa-code-branch"></i> <span id="{{ item.name | lower | replace(' ', '-') }}-forks">...</span></span> |
| 140 | + <div class="project-info"> |
| 141 | + <div class="project-name">{{ item.name }}</div> |
| 142 | + {% if item.github_url %} |
| 143 | + <div class="project-details"> |
| 144 | + <!-- Fixed width for consistent alignment, using FontAwesome icons --> |
| 145 | + <span class="language"><i class="fas fa-code"></i> <span id="{{ item.name | lower | replace(' ', '-') }}-language">...</span></span> |
| 146 | + <span class="stars"><i class="far fa-star"></i> <span id="{{ item.name | lower | replace(' ', '-') }}-stars">...</span></span> |
| 147 | + <span class="forks"><i class="fas fa-code-branch"></i> <span id="{{ item.name | lower | replace(' ', '-') }}-forks">...</span></span> |
| 148 | + </div> |
| 149 | + {% endif %} |
132 | 150 | </div> |
133 | | - {% endif %} |
134 | | - </span> |
135 | | - {% if item.logo %} |
136 | | - <span style="width: {{ item.logo_scale or '100%' }}"> |
137 | | - <img src="{{ item.logo }}" alt="{{ item.name }} logo" class="project-logo"> |
138 | | - </span> |
139 | | - {% endif %} |
| 151 | + {% if item.logo %} |
| 152 | + <div class="logo-container"> |
| 153 | + <img src="{{ item.logo }}" alt="{{ item.name }} logo" class="project-logo"> |
| 154 | + </div> |
| 155 | + {% endif %} |
140 | 156 | </div> |
141 | 157 | <div class="project-description">{{ item.description }}</div> |
142 | 158 | </a> |
|
145 | 161 | </section> |
146 | 162 | {% endfor %} |
147 | 163 |
|
148 | | -<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script> <!-- FontAwesome Kit --> |
149 | | -<script> |
150 | | - document.addEventListener('DOMContentLoaded', function () { |
151 | | - const projects = document.querySelectorAll('.project'); |
152 | | -
|
153 | | - projects.forEach(project => { |
154 | | - const githubUrl = project.getAttribute('data-repo'); |
155 | | - if (githubUrl) { |
156 | | - // Construct the GitHub API URL by inserting "api." after "https://" |
157 | | - const apiUrl = githubUrl.replace('https://github.com/', 'https://api.github.com/repos/'); |
158 | | -
|
159 | | - fetch(apiUrl) |
160 | | - .then(response => response.json()) |
161 | | - .then(data => { |
162 | | - // Use project name to generate IDs |
163 | | - const idPrefix = data.name.toLowerCase().replace(/ /g, '-'); |
164 | | -
|
165 | | - document.getElementById(`${idPrefix}-language`).textContent = data.language || 'N/A'; |
166 | | - document.getElementById(`${idPrefix}-stars`).textContent = data.stargazers_count || 0; |
167 | | - document.getElementById(`${idPrefix}-forks`).textContent = data.forks_count || 0; |
168 | | - }) |
169 | | - .catch(error => console.error('Error fetching GitHub data:', error)); |
170 | | - } |
171 | | - }); |
172 | | - }); |
173 | | -</script> |
174 | 164 | {% endblock %} |
0 commit comments