Skip to content

Commit 7e00662

Browse files
committed
revise blog
1 parent 3792546 commit 7e00662

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

blog/src/Main.xmlui

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
image: "blog-scrabble.png"
1111
}
1212
]}`>
13+
<Button variant="ghost" label="toggle threshold" padding="$space-1" onClick="toggleThreshold()" />
1314
<AppState
1415
id="navState"
1516
initialValue="{{
@@ -21,17 +22,17 @@
2122
<property name="logoTemplate">
2223
<CHStack height="$space-6">
2324
<Logo />
24-
<Text variant="em">Tutorials, tips, best practices</Text>
2525
</CHStack>
2626
</property>
2727
<property name="profileMenuTemplate">
28+
<Text variant="em">Tutorials, tips, best practices</Text>
2829
<SpaceFiller />
2930
<Link when="{!['/', '/blog'].includes($pathname)}" to="/">
3031
<Button height="$space-6" padding="$space-2" label="All Posts" />
3132
</Link>
3233
</property>
3334
</AppHeader>
34-
<NavPanel>
35+
<NavPanel when="{showNav()}" >
3536
<NavGroup label="Recent posts" to="/blog">
3637
<NavLink
3738
label="Welcome to the XMLUI blog!"

blog/src/Main.xmlui.xs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
function showNav() {
22
return posts.length > showNavPanelThreshold && mediaSize.sizeIndex > 2;
3+
}
4+
5+
function toggleThreshold() {
6+
if (showNavPanelThreshold> 0) {
7+
showNavPanelThreshold = 0
8+
} else {
9+
showNavPanelThreshold = 6
10+
}
311
}

blog/src/components/BlogOverview.xmlui

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Component name="BlogOverview">
2+
<Debug />
23
<CVStack>
34
<VStack width="100%">
45
<List data="{

blog/src/components/BlogPage.xmlui

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Component name="BlogPage">
2+
<Debug />
23
<VStack gap="0">
34
<H1>{$props.post.title}</H1>
45
<Text>{$props.post.date} • {$props.post.author}</Text>

blog/src/components/Debug.xmlui

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<Component name="Debug">
2+
<!--
23
<AppState id="navState" />
34
<Text>
45
navState: {JSON.stringify(navState.value)}, sizeIndex {JSON.stringify(mediaSize.sizeIndex)}, path {$pathname}
56
</Text>
7+
-->
68
</Component>

0 commit comments

Comments
 (0)