diff --git a/apps/demo/pages/app/index.tsx b/apps/demo/pages/app/index.tsx index 6d3912c6b5..3a89040ba9 100644 --- a/apps/demo/pages/app/index.tsx +++ b/apps/demo/pages/app/index.tsx @@ -1,53 +1,76 @@ -import fbsetup from "../../public/fb-setup.png"; import formbricks from "@formbricks/js"; import Image from "next/image"; +import { useEffect, useState } from "react"; +import fbsetup from "../../public/fb-setup.png"; export default function AppPage({}) { + const [darkMode, setDarkMode] = useState(false); + + useEffect(() => { + if (darkMode) { + document.body.classList.add("dark"); + } else { + document.body.classList.remove("dark"); + } + }, [darkMode]); + return ( -
- This app helps you test your in-app surveys. You can create an test user actions, create and update - user attributes, etc. -
++ This app helps you test your in-app surveys. You can create and test user actions, create and + update user attributes, etc. +
++
Copy the environment ID of your Formbricks app to the env variable in demo/.env
- Look at the logs to understand how the widget works. Open your browser console{" "} - to see the logs. +
+ Look at the logs to understand how the widget works.{" "} + Open your browser console to see the logs.
- {/*+
On formbricks.logout() a few things happen: New person is created and{" "} surveys & no-code actions are pulled from Formbricks:.
-+
If you made a change in Formbricks app and it does not seem to work, hit 'Logout' and try again.
@@ -56,7 +79,7 @@ export default function AppPage({}) {+
This button sends a{" "} Code Action @@ -75,18 +98,24 @@ export default function AppPage({}) {
+
This button sends a{" "} - + No Code Action {" "} as long as you created it beforehand in the Formbricks App.{" "} - + Here are instructions on how to do it.
@@ -98,17 +127,17 @@ export default function AppPage({}) { onClick={() => { formbricks.setAttribute("Plan", "Free"); }} - className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700"> + className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700 dark:bg-gray-700 dark:hover:bg-gray-600"> Set Plan to 'Free'+
This button sets the{" "} + className="underline dark:text-blue-500"> attribute {" "} 'Plan' to 'Free'. If the attribute does not exist, it creates it. @@ -121,17 +150,17 @@ export default function AppPage({}) { onClick={() => { formbricks.setAttribute("Plan", "Paid"); }} - className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700"> + className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700 dark:bg-gray-700 dark:hover:bg-gray-600"> Set Plan to 'Paid'
+
This button sets the{" "} + className="underline dark:text-blue-500"> attribute {" "} 'Plan' to 'Paid'. If the attribute does not exist, it creates it. @@ -144,17 +173,17 @@ export default function AppPage({}) { onClick={() => { formbricks.setEmail("test@web.com"); }} - className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700"> + className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700 dark:bg-gray-700 dark:hover:bg-gray-600"> Set Email
+
This button sets the{" "} + className="underline dark:text-blue-500"> user email {" "} 'test@web.com' @@ -167,17 +196,17 @@ export default function AppPage({}) { onClick={() => { formbricks.setUserId("THIS-IS-A-VERY-LONG-USER-ID-FOR-TESTING"); }} - className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700"> + className="mb-4 rounded-lg bg-slate-800 px-6 py-3 text-white hover:bg-slate-700 dark:bg-gray-700 dark:hover:bg-gray-600"> Set User ID
+
This button sets an external{" "} + className="underline dark:text-blue-500"> user ID {" "} to 'THIS-IS-A-VERY-LONG-USER-ID-FOR-TESTING' diff --git a/apps/demo/tailwind.config.js b/apps/demo/tailwind.config.js index fa51e9f4b3..0ccb1b5185 100644 --- a/apps/demo/tailwind.config.js +++ b/apps/demo/tailwind.config.js @@ -5,6 +5,7 @@ module.exports = { "./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}", ], + darkMode: "class", theme: { extend: {}, }, diff --git a/packages/js/src/components/ConsentQuestion.tsx b/packages/js/src/components/ConsentQuestion.tsx index 565a8e62b9..1c18445c39 100644 --- a/packages/js/src/components/ConsentQuestion.tsx +++ b/packages/js/src/components/ConsentQuestion.tsx @@ -59,7 +59,7 @@ export default function ConsentQuestion({ e.preventDefault(); handleSumbit(answer); }}> -
{question.lowerLabel}
{question.upperLabel}