- <_Dialog.Content
- onInteractOutside={onHide}
- onPointerDownOutside={onHide}
- onEscapeKeyDown={onHide}
- className="tl-analytics-dialog-content"
- >
- <_Dialog.Title className="tl-analytics-dialog-title">Privacy settings
- <_Dialog.Description className="tl-analytics-dialog-body">
- This website uses cookies to collect analytics from visitors. Read our{' '}
-
- cookie policy
- {' '}
- to learn more.
-
- <_Dialog.Close className="tl-analytics-dialog-close" asChild>
-
-
-
-
-
-
- <_Switch.Root
- className="tl-analytics-checkbox"
- id="privacy-analytics"
- checked={isChecked}
- onCheckedChange={onChange}
- >
- <_Switch.Thumb />
-
-
-
-
-
-
-
- )
-}
diff --git a/apps/analytics/src/components/CookieConsentBanner.ts b/apps/analytics/src/components/CookieConsentBanner.ts
new file mode 100644
index 000000000000..7440434999df
--- /dev/null
+++ b/apps/analytics/src/components/CookieConsentBanner.ts
@@ -0,0 +1,85 @@
+import { DOT_DEV_COOKIE_POLICY_URL } from '../constants'
+import { CookieConsentState } from '../state/cookie-consent-state'
+import { ThemeState } from '../state/theme-state'
+
+export function createCookieConsentBanner(
+ cookieConsentState: CookieConsentState,
+ themeState: ThemeState
+): HTMLElement | null {
+ const consent = cookieConsentState.getValue()
+ const theme = themeState.getValue()
+
+ // Don't show banner if consent is already given
+ if (consent !== 'unknown') return null
+
+ // Create banner element
+ const banner = document.createElement('div')
+ banner.className = 'tl-analytics-banner'
+ banner.setAttribute('data-theme', theme)
+
+ // Create content
+ banner.innerHTML = `
+