diff --git a/apps/demo/styles/globals.css b/apps/demo/styles/globals.css index b5c61c9567..640abab484 100644 --- a/apps/demo/styles/globals.css +++ b/apps/demo/styles/globals.css @@ -1,3 +1,26 @@ @tailwind base; @tailwind components; @tailwind utilities; + +/* Example on overriding packages/js colors */ +.dark { + --fb-brand-color: red; + --fb-brand-text-color: white; + --fb-border-color: green; + --fb-border-color-highlight: var(--slate-500); + --fb-focus-color: red; + --fb-heading-color: yellow; + --fb-subheading-color: green; + --fb-info-text-color: orange; + --fb-signature-text-color: blue; + --fb-survey-background-color: black; + --fb-accent-background-color: rgb(13, 13, 12); + --fb-accent-background-color-selected: red; + --fb-placeholder-color: white; + --fb-shadow-color: yellow; + --fb-rating-fill: var(--yellow-300); + --fb-rating-hover: var(--yellow-500); + --fb-back-btn-border: currentColor; + --fb-submit-btn-border: transparent; + --fb-rating-selected: black; +} diff --git a/packages/surveys/package.json b/packages/surveys/package.json index 80de10b8b8..9d1e91e49c 100644 --- a/packages/surveys/package.json +++ b/packages/surveys/package.json @@ -33,6 +33,7 @@ "tailwindcss": "^3.3.3", "terser": "^5.22.0", "vite": "^4.4.11", - "vite-plugin-dts": "^3.6.0" + "vite-plugin-dts": "^3.6.0", + "vite-tsconfig-paths": "^4.2.1" } } diff --git a/packages/surveys/src/components/Progress.tsx b/packages/surveys/src/components/Progress.tsx deleted file mode 100644 index c57e4af124..0000000000 --- a/packages/surveys/src/components/Progress.tsx +++ /dev/null @@ -1,9 +0,0 @@ -export default function Progress({ progress, brandColor }: { progress: number; brandColor: string }) { - return ( -
-
-
- ); -} diff --git a/packages/surveys/src/components/BackButton.tsx b/packages/surveys/src/components/buttons/BackButton.tsx similarity index 59% rename from packages/surveys/src/components/BackButton.tsx rename to packages/surveys/src/components/buttons/BackButton.tsx index a031cb46bc..ae9b402b15 100644 --- a/packages/surveys/src/components/BackButton.tsx +++ b/packages/surveys/src/components/buttons/BackButton.tsx @@ -1,4 +1,4 @@ -import { cn } from "../../../lib/cn"; +import { cn } from "@/lib/utils"; interface BackButtonProps { onClick: () => void; @@ -12,7 +12,7 @@ export function BackButton({ onClick, backButtonLabel, tabIndex = 2 }: BackButto tabIndex={tabIndex} type={"button"} className={cn( - "flex items-center rounded-md border border-transparent px-3 py-3 text-base font-medium leading-4 shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2" + "border-back-button-border text-heading focus:ring-focus flex items-center rounded-md border px-3 py-3 text-base font-medium leading-4 shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2" )} onClick={onClick}> {backButtonLabel || "Back"} diff --git a/packages/surveys/src/components/SubmitButton.tsx b/packages/surveys/src/components/buttons/SubmitButton.tsx similarity index 65% rename from packages/surveys/src/components/SubmitButton.tsx rename to packages/surveys/src/components/buttons/SubmitButton.tsx index d0de273ec8..7c9e265c6c 100644 --- a/packages/surveys/src/components/SubmitButton.tsx +++ b/packages/surveys/src/components/buttons/SubmitButton.tsx @@ -1,11 +1,8 @@ import { useCallback } from "preact/hooks"; -import { cn } from "../../../lib/cn"; -import { isLight } from "../lib/utils"; interface SubmitButtonProps { buttonLabel: string | undefined; isLastQuestion: boolean; - brandColor: string; onClick: () => void; focus?: boolean; tabIndex?: number; @@ -15,7 +12,6 @@ interface SubmitButtonProps { function SubmitButton({ buttonLabel, isLastQuestion, - brandColor, onClick, tabIndex = 1, focus = false, @@ -38,11 +34,7 @@ function SubmitButton({ type={type} tabIndex={tabIndex} autoFocus={focus} - className={cn( - "flex items-center rounded-md border border-transparent px-3 py-3 text-base font-medium leading-4 shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2", - isLight(brandColor) ? "text-black" : "text-white" - )} - style={{ backgroundColor: brandColor }} + className="bg-brand border-submit-button-border text-on-brand focus:ring-focus flex items-center rounded-md border px-3 py-3 text-base font-medium leading-4 shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2" onClick={onClick}> {buttonLabel || (isLastQuestion ? "Finish" : "Next")} diff --git a/packages/surveys/src/components/FormbricksBranding.tsx b/packages/surveys/src/components/general/FormbricksBranding.tsx similarity index 69% rename from packages/surveys/src/components/FormbricksBranding.tsx rename to packages/surveys/src/components/general/FormbricksBranding.tsx index fd8564dd13..52516555a7 100644 --- a/packages/surveys/src/components/FormbricksBranding.tsx +++ b/packages/surveys/src/components/general/FormbricksBranding.tsx @@ -5,10 +5,10 @@ export default function FormbricksBranding() { target="_blank" tabIndex={-1} className="mb-5 mt-2 flex justify-center"> -

+

Powered by{" "} - Formbricks + Formbricks

diff --git a/packages/surveys/src/components/Headline.tsx b/packages/surveys/src/components/general/Headline.tsx similarity index 52% rename from packages/surveys/src/components/Headline.tsx rename to packages/surveys/src/components/general/Headline.tsx index 9b1869aa71..f9072f3ed7 100644 --- a/packages/surveys/src/components/Headline.tsx +++ b/packages/surveys/src/components/general/Headline.tsx @@ -7,11 +7,14 @@ interface HeadlineProps { export default function Headline({ headline, questionId, style, required = true }: HeadlineProps) { return ( -