Skip to content

Commit

Permalink
Fix links + readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
john093e committed Aug 3, 2024
1 parent 8c7c9ae commit e336171
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 158 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@

## Demo
Visit the folowing third party website []() links to see zoid in action
1. Extemely Basic integration
Visit the following third party website [third-party-nextjs-zoid.vercel.app](https://third-part-nextjs-zoid.vercel.app/) links to see zoid in action
1. Extemely Basic integration [Button](https://third-part-nextjs-zoid.vercel.app/test-button.html)

2. Some features tested


## Installation

2. Some features tested [Advanced](https://third-part-nextjs-zoid.vercel.app/test-advanced.html)

> [!NOTE]
> Each Zoiid Ifame comes from the following [NextJs 14](https://nextjs-zoid.vercel.app/) app
## About thhis repo
## About this repo
This repo is based on the starter [create-t3-turbo](https://github.com/t3-oss/create-t3-turbo)
It uses [Turborepo](https://turborepo.org) and contains:

Expand Down
45 changes: 10 additions & 35 deletions apps/nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next
It integrate [Zoid](https://github.com/krakenjs/zoid) with the help of [Rollup](rollupjs.org/).


## What's in?
## 1. What's in?

We try to keep this project as simple as possible, so you can start with just the scaffolding we set up for you, and add additional things later when they become necessary.

Expand All @@ -24,21 +24,6 @@ We try to keep this project as simple as possible, so you can start with just th
- [Rollup](https://rollupjs.org)


## Getting Started

### 1. First, set your env file
- Copy `.env.example` at the same place
- Rename the copy to `.env`

### 2. run the development server:

```bash
# First install the depedencies
npm install
# Then start Next.js dev server, Under the hood it will build bundle and watch Zoid components
npm run dev
```

### 2. Embbed the Zoid component
Embed into any vanilla Html page one of the following Zoid test component :
#### a. "MyZoidComponent" :
Expand Down Expand Up @@ -66,29 +51,19 @@ A simple Button.
> [!NOTE]
> Change `localhost:3000` with your registred domain on production
### 3. Run the Page
Run your page under localhost or registred domain

### 4.
## Required Files
- **rollup.config.mjs** :
To bundle each zoid component with its dependencies and generate the \[filename\].js

Open [http://localhost:3000](http://localhost:3000) with your browser to see the usual HelloWold page.
- **tsconfig.rollup.json** :
Typescript configuratioon specific to the bundlling process

## Terminal Command
- **src/types/zoid.d.ts** :
An ugly but working typing of zoid and some other libarry from the @krakenJs suite

```bash
# Build and watch Zoid components, then start Next.js dev server
npm run dev
# Build Zoid components and then Next.js for production
npm run build
# Build Zoid components on demand
npm run build:zoid
```

## Required Files
- tsconfig.rollup.json
- rollup.config.mjs
- src/types/zoid.d.ts
- components/zoid/*.ts
- **components/zoid/*.ts** :
Folder to place the Zoid components, for now the RollupJs config expect to find a zoid components per .ts, so eah zoid omponoent should be .ts and everything in on file.
- app/api/widgets/[component]/route
- a page with Zoid integrated :
- example 1: app/zoid-button/page.tsx
Expand Down
119 changes: 11 additions & 108 deletions apps/nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,113 +1,16 @@
import Image from "next/image";
import Link from "next/link";

export default function Home() {
export const runtime = "edge";

export default function HomePage() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
Get started by editing&nbsp;
<code className="font-mono font-bold">src/app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:size-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://vercel.com"
target="_blank"
rel="noopener noreferrer"
>
By{" "}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className="dark:invert"
width={100}
height={24}
priority
/>
</a>
<main className="container h-screen py-16">
<div className="flex flex-col items-center justify-center gap-4 max-w-lg text-center w-full mx-auto ">
<h1 className="text-5xl font-extrabold tracking-tight sm:text-[5rem]">
Next Js using Zoid
</h1>
<p>This website expose 2 Zoid components to the followinng website : <Link href="third-part-nextjs-zoid.vercel.app">third-part-nextjs-zoid.vercel.app</Link></p>
</div>
</div>

<div className="relative z-[-1] flex place-items-center before:absolute before:h-[300px] before:w-full before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 sm:before:w-[480px] sm:after:w-[240px] before:lg:h-[360px]">
<Image
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>

<div className="mb-32 grid text-center lg:mb-0 lg:w-full lg:max-w-5xl lg:grid-cols-4 lg:text-left">
<a
href="https://nextjs.org/docs"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Docs{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Find in-depth information about Next.js features and API.
</p>
</a>

<a
href="https://nextjs.org/learn"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Learn{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Learn about Next.js in an interactive course with&nbsp;quizzes!
</p>
</a>

<a
href="https://vercel.com/templates"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Templates{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Explore starter templates for Next.js.
</p>
</a>

<a
href="https://vercel.com/new"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Deploy{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-balance text-sm opacity-50">
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
</main>
</main>
);
}
6 changes: 3 additions & 3 deletions apps/nextjs/src/app/zoid-advanced/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { Toaster } from "@acme/ui/toast";

export const metadata: Metadata = {
title: "Advanced example with Zoid",
description: "Simple example with Zoid",
description: "Advanced example with Zoid",
openGraph: {
title: "Advanced example with Zoid",
description: "Simple example with Zoid",
description: "Advanced example with Zoid",
url: "https://nextjs-zoid.vercel.app",
siteName: "Advanced example with Zoid",
siteName: "NextJs Zoid",
},
};

Expand Down
2 changes: 1 addition & 1 deletion apps/third-party-website/public/test-advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<div class="block absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-full">
<div class="relative mx-auto border-gray-800 dark:border-gray-800 bg-gray-800 border-[8px] rounded-t-xl h-[172px] max-w-[301px] md:h-[294px] md:max-w-[512px]">
<div class="rounded-lg overflow-hidden h-[156px] md:h-[278px] bg-white dark:bg-gray-800 relative">
<div class="rounded-lg overflow-hidden h-[156px] md:h-[278px] bg-white dark:bg-gray-950 relative">

<!-- ========================================================== -->
<!-- ADD A TARGET CONTAINER FO THE IFRAME -->
Expand Down
8 changes: 4 additions & 4 deletions apps/third-party-website/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export const runtime = "edge";
export default function HomePage() {
return (
<main className="container h-screen py-16">
<div className="flex flex-col items-center justify-center gap-4">
<h1 className="text-5xl font-extrabold tracking-tight sm:text-[5rem]">
<div className="flex flex-col items-center justify-center gap-4 max-w-lg w-full mx-auto">
<h1 className="text-5xl font-extrabold tracking-tight sm:text-[5rem] text-center">
Third-Part Vanilla HTML Website
</h1>
<div className="w-full max-w-2xl overflow-y-scroll">
<p>Test 1 : basic button <Link href="/test-button">/test-button</Link></p>
<p>Test 2 : basic button <Link href="/test-advanced" >/test-advanced</Link></p>
<p>Test 1 : basic button <Link href="/test-button.html">/test-button</Link></p>
<p>Test 2 : basic button <Link href="/test-advanced.html" >/test-advanced</Link></p>
</div>
</div>
</main>
Expand Down

0 comments on commit e336171

Please sign in to comment.