Skip to content

Commit 7bd0737

Browse files
committed
Refactor
1 parent 8f59abc commit 7bd0737

File tree

5 files changed

+57
-48
lines changed

5 files changed

+57
-48
lines changed

src/Elastic.Markdown/Assets/markdown/typography.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030

3131
a {
3232
font-family: "Inter", sans-serif;
33-
@apply text-blue-elastic hover:underline;
34-
}
35-
36-
* {
37-
scroll-margin-top: calc(var(--spacing) * 26);
33+
@apply text-blue-elastic underline hover:text-blue-800;
3834
}
3935
}

src/Elastic.Markdown/Assets/styles.css

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,6 @@
1717
background-repeat: no-repeat;
1818
}
1919

20-
#pages-nav, #toc-nav {
21-
&::-webkit-scrollbar-track {
22-
background-color: transparent;
23-
}
24-
&:hover::-webkit-scrollbar-thumb {
25-
background-color: var(--color-gray-300);
26-
}
27-
&::-webkit-scrollbar {
28-
width: calc(var(--spacing) * 2);
29-
height: calc(var(--spacing) * 2);
30-
}
31-
&::-webkit-scrollbar-thumb {
32-
border-radius: var(--spacing);
33-
}
34-
35-
scrollbar-gutter: stable;
36-
}
37-
3820
#pages-nav li.current {
3921
position: relative;
4022
&::before {
@@ -55,19 +37,51 @@
5537
}
5638
}
5739

58-
5940
@layer components {
60-
.btn {
61-
@apply px-4 py-2 rounded-md bg-blue-elastic text-white;
41+
.link {
42+
font-family: "Mier B", "Inter", sans-serif;
43+
@apply
44+
text-blue-elastic
45+
text-nowrap
46+
font-semibold
47+
hover:text-blue-800
48+
inline-flex
49+
justify-center
50+
items-center;
51+
52+
.link-arrow {
53+
@apply
54+
shrink-0
55+
size-7
56+
ml-2
57+
transition-transform
58+
ease-out;
59+
}
60+
61+
&:hover{
62+
svg {
63+
@apply translate-x-2;
64+
}
65+
}
66+
}
67+
68+
.sidebar {
69+
.sidebar-nav {
70+
@apply sticky top-22 z-30 overflow-y-auto;
71+
max-height: calc(100vh - var(--spacing) * 22);
72+
}
73+
74+
.sidebar-link {
75+
@apply
76+
text-ink-light
77+
hover:text-black
78+
text-sm
79+
leading-[1.2em]
80+
tracking-[-0.02em];
81+
}
6282
}
6383
}
6484

65-
66-
.sd-tab-set {
67-
@apply flex overflow-x-scroll;
68-
69-
70-
input {
71-
@apply hidden;
72-
}
85+
* {
86+
scroll-margin-top: calc(var(--spacing) * 26);
7387
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@inherits RazorSlice<LayoutViewModel>
2-
<aside class="hidden lg:block order-1 w-100 border-r-1 border-r-gray-200">
3-
<nav id="pages-nav" class="sticky top-22 z-10 max-h-[calc(100vh-var(--spacing)*22)] overflow-y-auto pr-6">
2+
<aside class="sidebar hidden lg:block order-1 w-100 border-r-1 border-r-gray-200">
3+
<nav id="pages-nav" class="sidebar-nav pr-6">
44
@(new HtmlString(Model.NavigationHtml))
55
</nav>
66
</aside>

src/Elastic.Markdown/Slices/Layout/_TableOfContents.cshtml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@inherits RazorSlice<LayoutViewModel>
22
@if (Model.IsRedesign)
33
{
4-
<aside class="hidden lg:block order-3 border-l-1 border-l-gray-200 w-80">
5-
<nav id="toc-nav" class="sticky top-22 z-30 max-h-[calc(100vh-var(--spacing)*22)] overflow-y-auto pl-6">
4+
<aside class="sidebar hidden lg:block order-3 border-l-1 border-l-gray-200 w-80">
5+
<nav id="toc-nav" class="sidebar-nav pl-6">
66
<div class="pt-6 pb-20">
77
@if (Model.PageTocItems.Count > 0)
88
{
@@ -12,9 +12,9 @@
1212
<div class="toc-progress-indicator absolute top-0 h-0 left-2 w-[1px] bg-blue-elastic transition-all duration-200 ease-out "></div>
1313
@foreach (var item in Model.PageTocItems)
1414
{
15-
<li class="flex has-[:hover]:border-l-gray-500 items-center ml-2 pl-4 border-l-1 border-l-gray-200 has-[.current]:border-l-blue-elastic!">
15+
<li class="has-[:hover]:border-l-gray-500 items-center ml-2 pl-4 border-l-1 border-l-gray-200 has-[.current]:border-l-blue-elastic!">
1616
<a
17-
class="inline-block text-sm leading-[1.2em] tracking-[-0.02em] my-1 hover:text-black @(item.Level == 3 ? "ml-4" : string.Empty)"
17+
class="sidebar-link inline-block my-1 @(item.Level == 3 ? "ml-4" : string.Empty)"
1818
href="#@item.Slug">
1919
@item.Heading
2020
</a>
@@ -24,9 +24,10 @@
2424
</div>
2525
}
2626
<div class="edit-this-page">
27-
<a href="@Model.GithubEditUrl" class="flex flex-nowrap items-center text-blue-elastic hover:text-blue-800">
28-
<span class="leading-0 mr-2">Edit this page</span>
29-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
27+
<a href="@Model.GithubEditUrl" class="link">
28+
Edit this page
29+
<svg class="link-arrow"
30+
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
3031
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3" />
3132
</svg>
3233
</a>

src/Elastic.Markdown/Slices/Layout/_TocTreeNav.cshtml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
var isCurrent = f == Model.CurrentDocument;
1212
<li class="block ml-2 pl-2 border-l-1 border-l-gray-200 group/li @(isCurrent ? "current" : string.Empty)">
1313
<div class="flex">
14-
<div class="w-5">
15-
</div>
1614
<a
17-
class="block my-1 text-sm leading-[1.2em] tracking-[-0.02em] group-[.current]/li:text-blue-elastic! hover:text-black @(isCurrent ? "" : string.Empty)"
15+
class="sidebar-link my-1 ml-5 group-[.current]/li:text-blue-elastic! @(isCurrent ? "" : string.Empty)"
1816
href="@f.Url"
1917
@(isCurrent ? "aria-current=page" : string.Empty)>
2018
@f.NavigationTitle
@@ -38,7 +36,7 @@
3836
viewBox="0 0 24 24"
3937
stroke-width="1.5"
4038
stroke="currentColor"
41-
class="w-4 mr-1 shrink -rotate-90 group-has-checked/label:rotate-0 cursor-pointer">
39+
class="w-4 mr-1 shrink -rotate-90 group-has-checked/label:rotate-0 cursor-pointer text-ink">
4240
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/>
4341
</svg>
4442
<input
@@ -51,7 +49,7 @@
5149
>
5250
<a
5351
href="@g.Index?.Url"
54-
class="block my-1 text-sm leading-[1.2em] tracking-[-0.02em] hover:text-black @(g.Depth == 1 ? "uppercase tracking-[0.05em] text-ink-light font-semibold" : string.Empty) @(containsCurrent ? "font-semibold" : string.Empty) @(isCurrent ? "current text-blue-elastic!" : string.Empty)">
52+
class="sidebar-link inline-block my-1 @(g.Depth == 1 ? "uppercase tracking-[0.05em] text-ink-light font-semibold" : string.Empty) @(containsCurrent ? "font-semibold" : string.Empty) @(isCurrent ? "current text-blue-elastic!" : string.Empty)">
5553
@g.Index?.NavigationTitle
5654
</a>
5755
</label>

0 commit comments

Comments
 (0)