Skip to content

Commit 363d93b

Browse files
committed
chore(showcase & codesnippet): add Sig prefix to signals
1 parent 92c5364 commit 363d93b

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

apps/website/src/components/code-snippet/code-snippet.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ export const CodeSnippet = component$<CodeSnippetProps>(({ name }) => {
2828

2929
const snippetPath = `/src/routes${location.url.pathname}snippets/${name}${lang}`;
3030

31-
const CodeSnippet = useSignal<string>();
31+
const CodeSnippetSig = useSignal<string>();
3232

3333
useTask$(async () => {
3434
// We need to call `await rawCodeSnippets[snippetPath]()` in development as it is `eager:false`
3535
if (isDev) {
36-
CodeSnippet.value = await rawCodeSnippets[snippetPath]();
36+
CodeSnippetSig.value = await rawCodeSnippets[snippetPath]();
3737
// We need to directly access the `components[componentPath]` expression in preview/production as it is `eager:true`
3838
} else {
39-
CodeSnippet.value = rawCodeSnippets[snippetPath];
39+
CodeSnippetSig.value = rawCodeSnippets[snippetPath];
4040
}
4141
});
4242
return (
4343
<div
4444
class={`shadow-3xl shadow-light-medium dark:shadow-dark-medium mb-6 rounded-xl border-2 border-slate-200 dark:border-slate-400`}
4545
>
46-
<Highlight code={CodeSnippet.value || ''} />
46+
<Highlight code={CodeSnippetSig.value || ''} />
4747
</div>
4848
);
4949
});

apps/website/src/components/showcase/showcase.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ export const Showcase = component$<ShowcaseProps>(({ name, ...props }) => {
3939

4040
console.log('componentPath', componentPath);
4141

42-
const Component = useSignal<Component<any>>();
43-
const ComponentRaw = useSignal<string>();
42+
const ComponentSig = useSignal<Component<any>>();
43+
const ComponentRawSig = useSignal<string>();
4444

4545
useTask$(async () => {
4646
// We need to call `await components[componentPath]()` in development as it is `eager:false`
4747
if (isDev) {
48-
Component.value = await components[componentPath]();
49-
ComponentRaw.value = await componentsRaw[componentPath]();
48+
ComponentSig.value = await components[componentPath]();
49+
ComponentRawSig.value = await componentsRaw[componentPath]();
5050
// We need to directly access the `components[componentPath]` expression in preview/production as it is `eager:true`
5151
} else {
52-
Component.value = components[componentPath];
53-
ComponentRaw.value = componentsRaw[componentPath];
52+
ComponentSig.value = components[componentPath];
53+
ComponentRawSig.value = componentsRaw[componentPath];
5454
}
5555
});
5656

@@ -71,11 +71,14 @@ export const Showcase = component$<ShowcaseProps>(({ name, ...props }) => {
7171
</TabList>
7272
<TabPanel class="shadow-light-medium dark:shadow-dark-medium border-qwikui-blue-300 dark:border-qwikui-purple-200 rounded-b-xl border-[1.5px] bg-slate-200 bg-slate-800 p-4 dark:bg-slate-900 md:p-12">
7373
<section class="flex flex-col items-center">
74-
{Component.value && <Component.value />}
74+
{ComponentSig.value && <ComponentSig.value />}
7575
</section>
7676
</TabPanel>
7777
<TabPanel class="border-qwikui-blue-300 dark:border-qwikui-purple-200 relative rounded-b-xl border-[1.5px]">
78-
<Highlight class="rounded-b-xl rounded-t-none" code={ComponentRaw.value || ''} />
78+
<Highlight
79+
class="rounded-b-xl rounded-t-none"
80+
code={ComponentRawSig.value || ''}
81+
/>
7982
</TabPanel>
8083
</Tabs>
8184
);

0 commit comments

Comments
 (0)