Skip to content

Commit 9285c4d

Browse files
committed
feat: add NqHeadline component and enhance documentation with new frontmatter options
1 parent 603ecd4 commit 9285c4d

File tree

16 files changed

+257
-32
lines changed

16 files changed

+257
-32
lines changed

docs/.vitepress/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ export default defineNimiqVitepressConfig({
114114
items: [
115115
{ text: 'Code Block', link: '/vitepress-theme/components/code-block' },
116116
{ text: 'Card', link: '/vitepress-theme/components/card' },
117-
{ text: 'Large Card', link: '/vitepress-theme/components/large-card' },
118117
{ text: 'Grid', link: '/vitepress-theme/components/grid' },
118+
{ text: 'Headline', link: '/vitepress-theme/components/headline' },
119+
{ text: 'Large Card', link: '/vitepress-theme/components/large-card' },
119120
{ text: 'Callout & Blockquotes', link: '/vitepress-theme/components/callouts-and-blockquotes' },
120121
{ text: 'Vitepress Components', link: '/vitepress-theme/components/vitepress-components' },
121122
],

docs/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
layout: 'home'
33
secondarySidebar: false
44
sidebar: false
5-
---
65

7-
# Nimiq UI
6+
title: Nimiq UI
7+
description: Build your app with the Nimiq theme
8+
---
89

9-
The home for Nimiq UI development and documentation.
10+
<NqHeadline />
1011

1112
<NqModulesGrid />
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Headlines
2+
3+
A versatile headline component that makes your content stand out with style. Perfect for page headers, section titles, and anywhere you need to grab attention.
4+
5+
## Props
6+
7+
| Name | Type | Default | Description |
8+
| ------------- | -------------------- | ----------- | ------------------------------------------------------- |
9+
| `title` | `string` | - | The main headline text (required) |
10+
| `description` | `string` | - | Supporting text that appears below the title (required) |
11+
| `label` | `string` | `undefined` | Optional label displayed above the title |
12+
| `h1` | `boolean` | `true` | Whether to render as h1 (larger) or h2 (smaller) |
13+
| `align` | `'center' \| 'left'` | `'center'` | Alignment of the headline content |
14+
15+
> [!NOTE]
16+
> The component can automatically use frontmatter values as fallbacks. If `title` or `description` are not provided as props, it will use the page's frontmatter `title` and `description` values.
17+
18+
> [!TIP]
19+
> Remember to [register `NqHeadline`](/vitepress-theme/#register-the-components) in your app.
20+
21+
## Examples
22+
23+
### Basic Headline
24+
25+
<ComponentPreview lang="vue">
26+
27+
<NqHeadline
28+
title="Welcome to Nimiq"
29+
description="The browser-based blockchain designed for simplicity and accessibility."
30+
/>
31+
32+
</ComponentPreview>
33+
34+
### With Label
35+
36+
<ComponentPreview lang="vue">
37+
38+
<NqHeadline
39+
label="Getting Started"
40+
title="Build Your First App"
41+
description="Learn how to create amazing applications with Nimiq in just a few minutes."
42+
/>
43+
44+
</ComponentPreview>
45+
46+
### Left Aligned
47+
48+
<ComponentPreview lang="vue">
49+
50+
<NqHeadline
51+
align="left"
52+
title="Documentation"
53+
description="Comprehensive guides and API references to help you build with Nimiq."
54+
/>
55+
56+
</ComponentPreview>
57+
58+
### As H2 (Smaller)
59+
60+
<ComponentPreview lang="vue">
61+
62+
<NqHeadline
63+
:h1="false"
64+
title="Nimiq Ecosystem"
65+
description="Explore the complete suite of tools and applications built on Nimiq."
66+
/>
67+
68+
</ComponentPreview>
69+
70+
### Complete Example
71+
72+
<ComponentPreview lang="vue">
73+
74+
<NqHeadline
75+
label="Feature Spotlight"
76+
title="Browser-Based Mining"
77+
description="Experience the world's first browser-based blockchain that requires no downloads or installations."
78+
align="left"
79+
/>
80+
81+
</ComponentPreview>
82+
83+
### Using Frontmatter Fallback
84+
85+
You can also use the component without explicit props and it will automatically use the page's frontmatter values:
86+
87+
```vue
88+
<!-- This will use the page's frontmatter title and description -->
89+
<NqHeadline label="Page Header" />
90+
```
91+
92+
```yaml
93+
---
94+
title: Getting Started with Nimiq
95+
description: Learn how to build amazing blockchain applications
96+
---
97+
```

docs/vitepress-theme/frontmatter.md

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@ The Nimiq Vitepress theme supports the following frontmatter options:
2626

2727
### Layout Options
2828

29-
| Option | Type | Default | Description |
30-
| ------------------ | ------------------- | ----------------------------------------------- | --------------------------------------------------------- |
31-
| `layout` | `'home' \| 'docs'` | `'docs'` | Layout type to use for the page |
32-
| `sidebar` | `boolean` | `true` for docs layout | Whether to show the sidebar |
33-
| `breadcrumbs` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the breadcrumbs navigation |
34-
| `outline` | `boolean` | `true` if headings exist | Whether to show the outline (table of contents) |
35-
| `secondarySidebar` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the secondary sidebar |
36-
| `widget` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the widget area in the secondary sidebar |
37-
| `changelog` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the changelog in the secondary sidebar |
38-
| `sourceCode` | `boolean \| string` | `true` for docs layout, `false` for home layout | Show source code controls. Can be a custom URL or boolean |
39-
| `sourceCodeLabel` | `string` | `'View Source'` | Label for the source code button |
40-
| `copyMarkdown` | `boolean` | Same as `sourceCode` | Show the copy markdown button independently |
29+
| Option | Type | Default | Description |
30+
| ---------------------- | --------------------- | ----------------------------------------------- | --------------------------------------------------------- |
31+
| `layout` | `'home' \| 'docs'` | `'docs'` | Layout type to use for the page |
32+
| `sidebar` | `boolean` | `true` for docs layout | Whether to show the sidebar |
33+
| `breadcrumbs` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the breadcrumbs navigation |
34+
| `outline` | `boolean` | `true` if headings exist | Whether to show the outline (table of contents) |
35+
| `secondarySidebar` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the secondary sidebar |
36+
| `widget` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the widget area in the secondary sidebar |
37+
| `changelog` | `boolean` | `true` for docs layout, `false` for home layout | Whether to show the changelog in the secondary sidebar |
38+
| `sourceCode` | `boolean \| string` | `true` for docs layout, `false` for home layout | Show source code controls. Can be a custom URL or boolean |
39+
| `sourceCodeLabel` | `string` | `'View Source'` | Label for the source code button |
40+
| `sourceCodePathPrefix` | `string \| undefined` | Auto-detected | Path prefix for source code URLs (e.g., `'docs'` or `''`) |
41+
| `copyMarkdown` | `boolean` | Same as `sourceCode` | Show the copy markdown button independently |
4142

4243
### Navigation Options
4344

@@ -160,6 +161,36 @@ By default, when `sourceCode` is `true`, the theme automatically generates a Git
160161
For example, if your page is at `docs/guide/introduction.md`, the generated URL will be:
161162
`https://github.com/your-repo/blob/main/docs/guide/introduction.md`
162163

164+
### Path Prefix Configuration
165+
166+
For most projects, the theme automatically detects the correct path structure. However, if you need to override this behavior, you can use the `sourceCodePathPrefix` option:
167+
168+
**For monorepo projects where VitePress runs from docs/ but files are in repo/docs/:**
169+
170+
```yaml
171+
---
172+
sourceCodePathPrefix: docs
173+
---
174+
```
175+
176+
**For standalone projects where VitePress runs from the root:**
177+
178+
```yaml
179+
---
180+
sourceCodePathPrefix: ''
181+
---
182+
```
183+
184+
**For custom directory structures:**
185+
186+
```yaml
187+
---
188+
sourceCodePathPrefix: documentation
189+
---
190+
```
191+
192+
If not specified, the theme will auto-detect the correct prefix based on the repository URL and common patterns. This ensures compatibility with both monorepo and standalone project structures.
193+
163194
## Controlling the Secondary Sidebar
164195

165196
The secondary sidebar contains both the outline (table of contents) and optional widget area. You can control them independently:

packages/nimiq-icons/src/flags/icons.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@
12681268
"body": "<mask id=\"nimiq-flags-zw-hexagon-pbk987\" width=\"32\" height=\"28\" x=\"0\" y=\"2\" maskUnits=\"userSpaceOnUse\" style=\"mask-type:alpha\"><path fill=\"#fff\" d=\"M31.15 14.71 24.707 3.54a2.58 2.58 0 00-2.234-1.29H9.582c-.92 0-1.77.49-2.23 1.29L.907 14.71c-.46.8-.46 1.78 0 2.58l6.445 11.17c.46.8 1.31 1.29 2.23 1.29h12.89c.92 0 1.77-.49 2.23-1.29l6.445-11.17c.464-.8.464-1.78.004-2.58\"/></mask><g fill=\"none\"><g mask=\"url(#nimiq-flags-zw-hexagon-pbk987)\"><path fill=\"#6DA544\" d=\"M1.962 0H32v32H1.962z\"/><path fill=\"#FFDA44\" d=\"M3.613 4.581H32v4.582l-4.069 6.875 4.07 6.875v4.58H3.612z\"/><path fill=\"#D80027\" d=\"M8.25 9.162H32v4.582l-1.687 2.25L32 18.325v4.581H8.25z\"/><path fill=\"#EEE\" d=\"M0 0v32l17.488-16z\"/><path fill=\"#D80027\" d=\"m6.437 11.825 1.032 3.188h3.35l-2.713 1.975 1.038 3.187-2.713-1.969-2.712 1.969 1.037-3.187-2.712-1.976h3.35z\"/><path fill=\"#FFDA44\" d=\"m9.281 16.263-2.7-.957-.212-1.937a1.044 1.044 0 10-2.032.475l-.75.756h1.344c0 1.4-1.044 1.4-1.044 2.794l.575 1.387h3.482l.58-1.387q.086-.198.107-.413c.5-.2.65-.719.65-.719\"/><path fill=\"#333\" d=\"m1.963 0 13.75 13.75H32v4.575H15.638L1.962 32H0l16-16L0 0z\"/><path fill=\"url(#nimiq-flags-zw-hexagon-pbk987)\" d=\"M31.15 14.71 24.707 3.54a2.58 2.58 0 00-2.234-1.29H9.582c-.92 0-1.77.49-2.23 1.29L.907 14.71c-.46.8-.46 1.78 0 2.58l6.445 11.17c.46.8 1.31 1.29 2.23 1.29h12.89c.92 0 1.77-.49 2.23-1.29l6.445-11.17c.464-.8.464-1.78.004-2.58\"/></g><defs><radialGradient id=\"nimiq-flags-zw-hexagon-pbk987\" cx=\"0\" cy=\"0\" r=\"1\" gradientTransform=\"matrix(30.943 0 0 30.9452 23.829 29.395)\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#1D1D1B\" stop-opacity=\".3\"/><stop offset=\"1\" stop-color=\"#E9B213\" stop-opacity=\"0\"/></radialGradient></defs></g>"
12691269
}
12701270
},
1271-
"lastModified": 1750837562,
1271+
"lastModified": 1751548397,
12721272
"width": 32,
12731273
"height": 32
12741274
}

packages/nimiq-icons/src/flags/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"prefix": "nimiq-flags",
33
"name": "nimiq-flags",
44
"total": 422,
5-
"version": "1.0.0-beta.54",
5+
"version": "1.0.0-beta.56",
66
"author": {
77
"name": "onmax",
88
"url": "https://github.com/onmax"

packages/nimiq-icons/src/flags/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nimiq-flags",
33
"description": "The Nimiq Flags as an iconify icon set.",
44
"version": "1.0.0-beta.56",
5-
"iconSetVersion": "1.0.0-beta.54",
5+
"iconSetVersion": "1.0.0-beta.56",
66
"main": "index.js",
77
"module": "index.mjs",
88
"types": "index.d.ts",

packages/nimiq-icons/src/icons/icons.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@
15861586
"hidden": true
15871587
}
15881588
},
1589-
"lastModified": 1750837562,
1589+
"lastModified": 1751548397,
15901590
"width": 12,
15911591
"height": 12
15921592
}

packages/nimiq-icons/src/icons/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"prefix": "nimiq",
33
"name": "nimiq-icons",
44
"total": 84,
5-
"version": "1.0.0-beta.54",
5+
"version": "1.0.0-beta.56",
66
"author": {
77
"name": "onmax",
88
"url": "https://github.com/onmax"

packages/nimiq-icons/src/icons/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nimiq-icons",
33
"description": "The Nimiq Icons as an iconify icon set.",
44
"version": "1.0.0-beta.56",
5-
"iconSetVersion": "1.0.0-beta.54",
5+
"iconSetVersion": "1.0.0-beta.56",
66
"main": "index.js",
77
"module": "index.mjs",
88
"types": "index.d.ts",

0 commit comments

Comments
 (0)