Skip to content

Commit 7d05ac5

Browse files
committed
fix: NqLinks TypeScript and add variant docs
1 parent b1d51e6 commit 7d05ac5

File tree

4 files changed

+43
-10
lines changed

4 files changed

+43
-10
lines changed

docs/uno.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export default defineConfig<PresetWind3Theme>({
128128
utilities: true,
129129
attributifyUtilities: true,
130130
typography: true,
131+
outputCSSLayer: false,
131132
}),
132133
presetIcons({
133134
collections: {
@@ -137,5 +138,5 @@ export default defineConfig<PresetWind3Theme>({
137138
},
138139
}),
139140
],
140-
outputToCssLayers: true,
141+
outputToCssLayers: false,
141142
})

docs/vitepress-theme/components/links.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ A component for displaying external links with consistent styling. Perfect for s
1111

1212
### NqLinksItem Interface
1313

14-
| Name | Type | Default | Description |
15-
| ------- | -------- | ----------- | ---------------------------------------------- |
16-
| `label` | `string` | required | The text displayed for the link |
17-
| `href` | `string` | required | The URL the link points to |
18-
| `icon` | `string` | `undefined` | Optional icon class (e.g., `i-nimiq:external`) |
19-
| `title` | `string` | `undefined` | Optional tooltip text for accessibility |
14+
| Name | Type | Default | Description |
15+
| --------- | -------- | ------------------- | ------------------------------------------------------------------------ |
16+
| `label` | `string` | required | The text displayed for the link |
17+
| `href` | `string` | required | The URL the link points to |
18+
| `icon` | `string` | `undefined` | Optional icon class (e.g., `i-nimiq:external`) |
19+
| `variant` | `string` | `nq-pill-secondary` | Pill variant: `blue`, `gold`, `green`, `secondary`, `tertiary`, `orange` |
20+
| `title` | `string` | `undefined` | Optional tooltip text for accessibility |
2021

2122
All links automatically open in a new tab with `target="_blank"` and include `rel="noopener noreferrer"` for security.
2223

@@ -98,6 +99,37 @@ Simple text links without icons for minimal designs.
9899

99100
</ComponentPreview>
100101

102+
### Links with Different Variants
103+
104+
Use different pill variants to color-code your links.
105+
106+
<ComponentPreview lang="vue">
107+
108+
<NqPlayground>
109+
<NqLinks :items="[
110+
{
111+
label: 'Documentation',
112+
href: '/docs',
113+
variant: 'nq-pill-blue',
114+
icon: 'i-nimiq:book'
115+
},
116+
{
117+
label: 'API Reference',
118+
href: '/api',
119+
variant: 'nq-pill-green',
120+
icon: 'i-nimiq:code'
121+
},
122+
{
123+
label: 'Support',
124+
href: '/support',
125+
variant: 'nq-pill-orange',
126+
icon: 'i-nimiq:help'
127+
}
128+
]" />
129+
</NqPlayground>
130+
131+
</ComponentPreview>
132+
101133
## Usage Notes
102134

103135
- Use either `item` for a single link or `items` for multiple links, not both

packages/nimiq-css/src/unocss/icons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface NimiqIconsOptions {
99
export function getNimiqIcons(_options: NimiqIconsOptions): { rules: Rule<PresetWind4Theme>[], iconsNames: string[] } {
1010
const rules: Rule<PresetWind4Theme>[] = [
1111
[
12-
/^i-nimiq:(.*)$/,
12+
/^i-nimiq:([\w-]+)$/,
1313
async function* ([, name], { symbols }) {
1414
const iconData = getIconData(nimiqIconsJson, name)
1515
if (!iconData) {

packages/nimiq-vitepress-theme/src/components/NqLinks.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ interface NqLinksItem {
55
label: string
66
href: string
77
icon?: string
8-
variant: `nq-pill-${'blue' | 'gold' | 'green' | 'secondary' | 'tertiary' | 'orange'}`
8+
variant?: `nq-pill-${'blue' | 'gold' | 'green' | 'secondary' | 'tertiary' | 'orange'}`
99
title?: string
1010
}
1111
12-
const props = defineProps<{ item?: NqLinksItem, items?: NqLinksItems[] }>()
12+
const props = defineProps<{ item?: NqLinksItem, items?: NqLinksItem[] }>()
1313
1414
const items = computed(() => props.items?.length ? props.items : props.item ? [props.item] : [])
1515
</script>

0 commit comments

Comments
 (0)