Skip to content

Commit 761b337

Browse files
committed
feat: add warning when browsing the main branch
1 parent 82db0b5 commit 761b337

File tree

1 file changed

+44
-35
lines changed

1 file changed

+44
-35
lines changed

src/Web/Documentation/show.view.php

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
<ul class="flex flex-col border-s border-(--ui-border)">
1919
<li :foreach="$this->chaptersForCategory($category) as $chapter" class="-ms-px ps-1.5">
2020
<a
21-
:href="$chapter->getUri()"
22-
class="
23-
group relative w-full px-2.5 py-1.5 flex items-center gap-1.5 text-sm focus:outline-none focus-visible:outline-none hover:text-(--ui-text-highlighted) data-[state=open]:text-(--ui-text-highlighted) transition-colors
24-
<?= $this->isCurrent($chapter)
25-
? 'text-(--ui-primary) after:absolute after:-left-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full after:transition-colors after:bg-(--ui-primary)'
26-
: 'text-(--ui-text-muted)' ?>
27-
">
21+
:href="$chapter->getUri()"
22+
class="
23+
group relative w-full px-2.5 py-1.5 flex items-center gap-1.5 text-sm focus:outline-none focus-visible:outline-none hover:text-(--ui-text-highlighted) data-[state=open]:text-(--ui-text-highlighted) transition-colors
24+
<?= $this->isCurrent($chapter)
25+
? 'text-(--ui-primary) after:absolute after:-left-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full after:transition-colors after:bg-(--ui-primary)'
26+
: 'text-(--ui-text-muted)' ?>
27+
">
2828
{{ $chapter->title }}
2929
</a>
3030
</li>
@@ -96,34 +96,43 @@ class="
9696
</article>
9797
<!-- On this page -->
9898
<nav class="w-2xs shrink-0 hidden xl:flex flex-col sticky max-h-[calc(100dvh-var(--ui-header-height))] overflow-auto top-28 pt-4 pl-12 pr-4">
99-
<div :if="($subChapters = $this->getSubChapters()) !== []" class="text-sm flex flex-col grow">
100-
<span class="inline-block font-bold text-[--primary] mb-3">On this page</span>
101-
<ul class="flex flex-col">
102-
<x-template :foreach="$subChapters as $url => $chapter">
103-
<li>
104-
<a :href="$url" :data-on-this-page="$chapter['title']" class="group relative text-sm flex items-center focus-visible:outline-(--ui-primary) py-1 text-(--ui-text-muted) hover:text-(--ui-text) data-[active]:text-(--ui-primary) transition-colors">
105-
{{ \Tempest\Support\Str\strip_tags($chapter['title']) }}
106-
</a>
107-
</li>
108-
<li :foreach="$chapter['children'] as $url => $title">
109-
<a :href="$url" :data-on-this-page="$title" class="pl-4 group relative text-sm flex items-center focus-visible:outline-(--ui-primary) py-1 text-(--ui-text-dimmed) hover:text-(--ui-text) data-[active]:text-(--ui-primary) transition-colors">
110-
{{ \Tempest\Support\Str\strip_tags($title) }}</span>
111-
</a>
112-
</li>
113-
</x-template>
114-
</ul>
115-
<!-- Suggest changes -->
116-
<div class="mt-auto text-sm">
117-
<a class="mt-4 text-(--ui-text-dimmed) hover:text-(--ui-text) transition inline-flex items-center gap-x-1.5" :href="$this->currentChapter->getEditPageUri()" target="_blank">
118-
<x-icon name="tabler:edit" />
119-
<span>Suggest changes to this page</span>
120-
</a>
121-
</div>
122-
<div class="my-10 flex">
123-
<a href="#top" class="border border-(--ui-border) bg-(--ui-bg-elevated) text-(--ui-text-muted) hover:text-(--ui-text) transition rounded-lg p-2">
124-
<x-icon name="tabler:arrow-up" class="size-5" />
125-
</a>
126-
</div>
99+
<div class="text-sm flex flex-col grow">
100+
<x-template :if="($subChapters = $this->getSubChapters()) !== []">
101+
<span class="inline-block font-bold text-[--primary] mb-3">On this page</span>
102+
<ul class="flex flex-col">
103+
<x-template :foreach="$subChapters as $url => $chapter">
104+
<li>
105+
<a :href="$url" :data-on-this-page="$chapter['title']" class="group relative text-sm flex items-center focus-visible:outline-(--ui-primary) py-1 text-(--ui-text-muted) hover:text-(--ui-text) data-[active]:text-(--ui-primary) transition-colors">
106+
{{ \Tempest\Support\Str\strip_tags($chapter['title']) }}
107+
</a>
108+
</li>
109+
<li :foreach="$chapter['children'] as $url => $title">
110+
<a :href="$url" :data-on-this-page="$title" class="pl-4 group relative text-sm flex items-center focus-visible:outline-(--ui-primary) py-1 text-(--ui-text-dimmed) hover:text-(--ui-text) data-[active]:text-(--ui-primary) transition-colors">
111+
{{ \Tempest\Support\Str\strip_tags($title) }}</span>
112+
</a>
113+
</li>
114+
</x-template>
115+
</ul>
116+
</x-template>
117+
<div class="mt-auto flex flex-col gap-y-4">
118+
<!-- Version warning -->
119+
<div :if="$this->currentChapter->version === \App\Web\Documentation\Version::MAIN">
120+
<div class="text-sm text-(--ui-warning) inline-flex items-baseline gap-x-1.5">
121+
<x-icon name="tabler:info-circle" class="translate-y-[2px] size-4 shrink-0" />
122+
<span>This documentation is for an upcoming version of Tempest and is subject to change.</span>
123+
</div>
124+
</div>
125+
<!-- Suggest changes -->
126+
<a class="text-sm text-(--ui-text-dimmed) hover:text-(--ui-text) transition inline-flex items-center gap-x-1.5" :href="$this->currentChapter->getEditPageUri()" target="_blank">
127+
<x-icon name="tabler:edit" class="size-4 shrink-0" />
128+
<span>Suggest changes to this page</span>
129+
</a>
130+
</div>
131+
<div class="my-10 flex">
132+
<a href="#top" class="border border-(--ui-border) bg-(--ui-bg-elevated) text-(--ui-text-muted) hover:text-(--ui-text) transition rounded-lg p-2">
133+
<x-icon name="tabler:arrow-up" class="size-5" />
134+
</a>
135+
</div>
127136
</div>
128137
</nav>
129138
</div>

0 commit comments

Comments
 (0)