Skip to content

Commit efc96e6

Browse files
ntainytechniq
andauthored
Fix source links for Simplified Charts and Tooltip in docs; Use blob/next instead of blob/main for links. (#534)
* docs: fix source links for nested components (Simplified Charts, Tooltip, TooltipContext); use blob/next instead of blob/main for github links. * Minor format (fix CI) --------- Co-authored-by: Sean Lynch <techniq35@gmail.com>
1 parent 32383cd commit efc96e6

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

packages/layerchart/src/routes/docs/+layout.svelte

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@
3030
const [type, name] = $derived(page.url.pathname.split('/').slice(2) ?? []);
3131
const title = $derived(page.data.meta?.title ?? name);
3232
const pageUrl = $derived(`src/routes/docs/${type}/${name}/+page.svelte?plain=1`);
33+
34+
const getComponentPath = (name: string) => {
35+
if (name.endsWith('Chart') && name !== 'Chart') return `charts/${name}`;
36+
if (name.startsWith('Tooltip')) return `tooltip/${name}`;
37+
return name;
38+
};
3339
const sourceUrl = $derived(
3440
['components', 'utils'].includes(type)
35-
? `src/lib/${type}/${name}.${type === 'components' ? 'svelte' : 'ts'}`
41+
? `src/lib/${type}/${getComponentPath(name)}.${type === 'components' ? 'svelte' : 'ts'}`
3642
: null
3743
);
3844
const {
@@ -121,7 +127,7 @@
121127
label="Source"
122128
{source}
123129
href={sourceUrl
124-
? `https://github.com/techniq/layerchart/blob/main/packages/layerchart/${sourceUrl}`
130+
? `https://github.com/techniq/layerchart/blob/next/packages/layerchart/${sourceUrl}`
125131
: ''}
126132
icon={mdiCodeTags}
127133
/>
@@ -130,7 +136,7 @@
130136
label="Page source"
131137
source={pageSource}
132138
href={pageUrl
133-
? `https://github.com/techniq/layerchart/blob/main/packages/layerchart/${pageUrl}`
139+
? `https://github.com/techniq/layerchart/blob/next/packages/layerchart/${pageUrl}`
134140
: ''}
135141
icon={mdiFileDocumentEditOutline}
136142
/>

0 commit comments

Comments
 (0)