|
2 | 2 | const hasSidebarLinks = theme.home.sidebar.links !== null; |
3 | 3 | const hasSidebarAnnouncement = theme.home.sidebar.announcement !== null; |
4 | 4 | const hasSidebarExtra = hasSidebarLinks || hasSidebarAnnouncement; |
5 | | - const sidebarItems = theme.home.sidebar.first_item === "info" |
6 | | - ? ["profile", ...(hasSidebarExtra ? ["links"] : [])] |
7 | | - : [...(hasSidebarExtra ? ["links"] : []), "profile"]; |
| 5 | + const sidebarItems = ["profile", ...(hasSidebarExtra ? ["extra"] : [])]; |
| 6 | +
|
| 7 | + if (theme.home.sidebar.first_item !== "info") sidebarItems.reverse(); |
8 | 8 | %> |
9 | 9 | <aside class="mx-10 hidden h-auto w-60 md:block"> |
10 | | - <div class="sticky top-[calc(var(--current-navbar-height)_+_1rem)]"> |
11 | | - <% sidebarItems.forEach((item, index) => { %> |
12 | | - <% const separated = index > 0; %> |
| 10 | + <div class="sticky top-[calc(var(--current-navbar-height)_+_1rem)] flex flex-col gap-6"> |
| 11 | + <% for (const item of sidebarItems) { %> |
13 | 12 | <% if (item === "profile") { %> |
14 | | - <div data-sidebar-panel class="box-border rounded-2xl border border-rd-gray-alpha-400 bg-rd-background-100 p-5 <%= separated ? 'mt-6' : '' %>"> |
| 13 | + <div data-sidebar-panel class="box-border rounded-2xl border border-rd-gray-alpha-400 bg-rd-background-100 p-4"> |
15 | 14 | <div class="flex justify-center"> |
16 | 15 | <%- image_tag(theme.defaults.avatar, {class: "h-20 w-20 rounded-2xl border border-rd-gray-alpha-400 p-px"}) %> |
17 | 16 | </div> |
|
24 | 23 | <%- partial('components/statistics') %> |
25 | 24 | </div> |
26 | 25 | <% } else { %> |
27 | | - <div data-sidebar-panel class="box-border overflow-hidden rounded-2xl border border-rd-gray-alpha-400 bg-rd-background-100 p-4 <%= separated ? 'mt-6' : '' %>"> |
28 | | - <div data-sidebar-header class="-mx-4 -mt-4 mb-2.5 border-b border-rd-gray-alpha-400 bg-rd-gray-100 p-4"> |
| 26 | + <div data-sidebar-panel class="box-border overflow-hidden rounded-2xl border border-rd-gray-alpha-400 bg-rd-background-100"> |
| 27 | + <div data-sidebar-header class="border-b border-rd-gray-alpha-400 bg-rd-gray-100 p-4"> |
29 | 28 | <div class="text-center font-title text-xl font-medium text-rd-gray-1000"><%= theme.info.title || config.title %></div> |
30 | 29 | <% if (hasSidebarAnnouncement && hasSidebarLinks) { %> |
31 | | - <div class="mt-2.5 mb-1 text-center text-sm text-rd-gray-900"><%- theme.home.sidebar.announcement %></div> |
| 30 | + <div class="mb-1 text-center text-sm text-rd-gray-900"><%- theme.home.sidebar.announcement %></div> |
32 | 31 | <% } %> |
33 | 32 | </div> |
34 | 33 | <% if (hasSidebarLinks) { %> |
|
46 | 45 | <% } %> |
47 | 46 | </div> |
48 | 47 | <% } %> |
49 | | - <% }); %> |
| 48 | + <% } %> |
50 | 49 | </div> |
51 | 50 | </aside> |
0 commit comments