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

feat(docs): start any example in stackblitz #1576

Merged
merged 13 commits into from
Oct 6, 2023
Prev Previous commit
Next Next commit
feat: added a check and a callout, only prisma or drizzle can be sele…
…cted
  • Loading branch information
mqshaikh8 committed Oct 1, 2023
commit ef932ec3d7e5fea468c81262464f425fdd305d19
21 changes: 17 additions & 4 deletions www/src/components/docs/exampleOptionForm.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const options = {
prisma: "Prisma",
tailwind: "Tailwind CSS",
trpc: "tRPC",
drizzle: "drizzle",
drizzle: "drizzle"
};
---

Expand All @@ -24,7 +24,7 @@ const options = {
"version": "1.0.0",
"description": "My Next.js app",
"scripts":{
"dev": " echo 'y' | npx create-t3-app example-app --CI ${checkedInputs} && cd ./my-app && rm ../package.json " }
"dev": " echo 'y' | npx create-t3-app example-app --CI ${checkedInputs} && cd ./example-app && rm ../package.json " }
}`,
},
settings: {
Expand All @@ -43,7 +43,7 @@ const options = {
console.error("Error", error);
}
}

function handleFormSubmit(e: Event) {
e.preventDefault();

Expand All @@ -60,6 +60,20 @@ const options = {

const form = document.getElementById("componentForm") as HTMLFormElement;

const prismaInput = document.getElementById('prisma') as HTMLInputElement;
const drizzleInput = document.getElementById('drizzle') as HTMLInputElement;

function handleCheckboxChange(e: Event) {
if (e.target === prismaInput && drizzleInput.checked) {
drizzleInput.checked = false;
} else if (e.target === drizzleInput && prismaInput.checked) {
prismaInput.checked = false;
}
}

prismaInput.addEventListener("change", handleCheckboxChange);
drizzleInput.addEventListener("change", handleCheckboxChange);

form.addEventListener("submit", handleFormSubmit);
</script>

Expand All @@ -75,7 +89,6 @@ const options = {
id={code}
type="checkbox"
name={name}
checked
value={code}
class="h-4 w-4"
/>
Expand Down
6 changes: 5 additions & 1 deletion www/src/pages/en/examples.mdx
mqshaikh8 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ lang: en
isMdx: true
---


import Callout from "../../components/docs/callout.tsx";
import Form from "../../components/docs/exampleOptionForm.astro";

You can try out different combinations of technologies that create-t3-app offers.

<Form />

<Callout type="info">
You cannot select `prisma` and `drizzle` at the same time.
</Callout>