Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More & Better Previews #22

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion webapps-starters/react/flowbite/src/views/browse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ export default function Browse() {
<h2 className="text-xs opacity-30 font-light">{component.versions} version(s)</h2>
<div className="my-2 bg-white dark:bg-[#222] dark:text-white p-4 text-sm max-h-52 max-w-32 overflow-hidden">
{component && component.component !== 'fail' ? (
<component.component />
<div style={{zoom: '30%'}}>
<component.component />
</div>
) : component.component === 'fail' ? (
<p className="text-xs">could not import</p>
) : (
Expand Down
18 changes: 16 additions & 2 deletions webapps-starters/react/flowbite/src/views/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,29 @@ function App() {
event.preventDefault() ;
setCurrentComponentIndex(i);
}}
className="m-1 p-2 hover:mx-2 duration-200 bg-white dark:bg-[#070707] dark:text-[#ccc] text-xs break-words"
className={`m-2 p-2 hover:mx-3 ${currentComponentIndex === i ? 'mx-3' : ''} duration-200 bg-white dark:bg-[#070707] dark:text-[#ccc] text-xs break-words rounded-lg`}
>
{currentComponentIndex === i ? (
c.description
) : (
c.description.length > 100 ? `${c.description.slice(0, 97)} ...` : c.description
c.description.length > 23 ? `${c.description.slice(0, 20)} ...` : c.description
)}
<br />
{
loadedComponents &&
i != null &&
i >= 0 &&
loadedComponents[i] &&
<div style={{zoom: '15%', pointerEvents: 'none'}}>
{loadedComponents.slice(i,i+1).map((item, index) => (
<div key={index} >
{ index === 0 ? <item.component /> : ''}
</div>
))}
</div>
}
<span className="text-xs opacity-50">{c.version}</span>

</a>
))}
</div>
Expand Down
4 changes: 3 additions & 1 deletion webapps-starters/react/nextui/src/views/browse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ export default function Browse() {
<h2 className="text-xs opacity-30 font-light">{component.versions} version(s)</h2>
<div className="my-2 bg-white dark:bg-[#222] dark:text-white p-4 text-sm max-h-52 max-w-32 overflow-hidden">
{component && component.component !== 'fail' ? (
<component.component />
<div style={{zoom: '30%'}}>
<component.component />
</div>
) : component.component === 'fail' ? (
<p className="text-xs">could not import</p>
) : (
Expand Down
18 changes: 16 additions & 2 deletions webapps-starters/react/nextui/src/views/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,29 @@ function App() {
event.preventDefault() ;
setCurrentComponentIndex(i);
}}
className="m-1 p-2 hover:mx-2 duration-200 bg-white dark:bg-[#070707] dark:text-[#ccc] text-xs break-words"
className={`m-2 p-2 hover:mx-3 ${currentComponentIndex === i ? 'mx-3' : ''} duration-200 bg-white dark:bg-[#070707] dark:text-[#ccc] text-xs break-words rounded-lg`}
>
{currentComponentIndex === i ? (
c.description
) : (
c.description.length > 100 ? `${c.description.slice(0, 97)} ...` : c.description
c.description.length > 23 ? `${c.description.slice(0, 20)} ...` : c.description
)}
<br />
{
loadedComponents &&
i != null &&
i >= 0 &&
loadedComponents[i] &&
<div style={{zoom: '15%', pointerEvents: 'none'}}>
{loadedComponents.slice(i,i+1).map((item, index) => (
<div key={index} >
{ index === 0 ? <item.component /> : ''}
</div>
))}
</div>
}
<span className="text-xs opacity-50">{c.version}</span>

</a>
))}
</div>
Expand Down
4 changes: 3 additions & 1 deletion webapps-starters/react/shadcn/src/views/browse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ export default function Browse() {
<h2 className="text-xs opacity-30 font-light">{component.versions} version(s)</h2>
<div className="my-2 bg-white dark:bg-[#222] dark:text-white p-4 text-sm max-h-52 max-w-32 overflow-hidden">
{component && component.component !== 'fail' ? (
<component.component />
<div style={{zoom: '30%'}}>
<component.component />
</div>
) : component.component === 'fail' ? (
<p className="text-xs">could not import</p>
) : (
Expand Down
18 changes: 16 additions & 2 deletions webapps-starters/react/shadcn/src/views/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,29 @@ function App() {
event.preventDefault() ;
setCurrentComponentIndex(i);
}}
className="m-1 p-2 hover:mx-2 duration-200 bg-white dark:bg-[#070707] dark:text-[#ccc] text-xs break-words"
className={`m-2 p-2 hover:mx-3 ${currentComponentIndex === i ? 'mx-3' : ''} duration-200 bg-white dark:bg-[#070707] dark:text-[#ccc] text-xs break-words rounded-lg`}
>
{currentComponentIndex === i ? (
c.description
) : (
c.description.length > 100 ? `${c.description.slice(0, 97)} ...` : c.description
c.description.length > 23 ? `${c.description.slice(0, 20)} ...` : c.description
)}
<br />
{
loadedComponents &&
i != null &&
i >= 0 &&
loadedComponents[i] &&
<div style={{zoom: '15%', pointerEvents: 'none'}}>
{loadedComponents.slice(i,i+1).map((item, index) => (
<div key={index} >
{ index === 0 ? <item.component /> : ''}
</div>
))}
</div>
}
<span className="text-xs opacity-50">{c.version}</span>

</a>
))}
</div>
Expand Down
6 changes: 4 additions & 2 deletions webapps-starters/svelte/flowbite/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@
<div class="my-2 bg-white dark:bg-[#222] dark:text-white p-4 text-sm
max-h-52 max-w-32 overflow-hidden">
{#if LoadedComponents[idx] && LoadedComponents[idx] != 'fail'}
<svelte:component this={LoadedComponents[idx]} >
</svelte:component>
<div style={{zoom: '30%'}}>
<svelte:component this={LoadedComponents[idx]} >
</svelte:component>
</div>
{:else if LoadedComponents[idx] && LoadedComponents[idx] === 'fail'}
<p class="text-xs">could not import</p>
{:else}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,15 @@
{#if currentComponentIndex == i}
{c.description}
{:else}
{c.description.length > 100 ? `${c.description.slice(0,97)} ...` : c.description}
{c.description.length > 23 ? `${c.description.slice(0,20)} ...` : c.description}
{/if}
<br/>
{#if LoadedComponents && i != null && i >= 0 && LoadedComponents[i]}
<div style={{zoom: '15%', pointerEvents: 'none'}}>
<svelte:component this={LoadedComponents[i]} >
</svelte:component>
</div>
{/if}
<span class="text-xs opacity-50">{c.version}</span>
</a>
{/each}
Expand Down