Skip to content

Commit cc9aa0e

Browse files
fix style/token application inside shadow dom
1 parent 5b3bda8 commit cc9aa0e

File tree

8 files changed

+38
-20
lines changed

8 files changed

+38
-20
lines changed

app/(app)/popup/layout.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/(app)/popup/page.tsx

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/test/layout.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
interface RootLayoutProps {
2+
children: React.ReactNode;
3+
}
4+
5+
export default async function Layout({ children }: RootLayoutProps) {
6+
return (
7+
<html lang="en">
8+
<body>{children}</body>
9+
</html>
10+
);
11+
}

app/test/popup/page.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use client';
2+
3+
import { useEffect, useState } from 'react';
4+
import Script from 'next/script';
5+
import { getSandboxId } from '@/lib/env';
6+
7+
export default function Page() {
8+
const [sandboxId, setSandboxId] = useState('');
9+
10+
useEffect(() => {
11+
setSandboxId(getSandboxId(window.location.origin));
12+
}, []);
13+
14+
return (
15+
<div>
16+
<p>This page has no stylesheets inorder to test the embed-popup.js bundled styles</p>
17+
{sandboxId && <Script src="/embed-popup.js" data-lk-sandbox-id={sandboxId} />}
18+
</div>
19+
);
20+
}

components/embed-popup/popup-view.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ export const PopupView = ({
126126
}}
127127
animate={{
128128
left: chatOpen && (isCameraEnabled || isScreenShareEnabled) ? '37.5%' : '50%',
129-
scale: chatOpen ? 0.41 : 1,
129+
scale: chatOpen ? 0.275 : 1,
130130
top: chatOpen ? '12px' : '50%',
131131
translateY: chatOpen ? '0' : '-50%',
132132
transformOrigin: chatOpen ? 'center top' : 'center center',
133133
}}
134134
transition={TILE_TRANSITION}
135135
className={cn(
136-
'bg-bg1 dark:bg-bg1 pointer-events-none absolute z-10 flex aspect-[1.5] w-64 items-center justify-center rounded-2xl border border-transparent transition-colors',
136+
'bg-bg1 dark:bg-bg1 pointer-events-none absolute z-10 flex aspect-square w-64 items-center justify-center rounded-2xl border border-transparent transition-colors',
137137
chatOpen && 'bg-bg1 border-separator1 drop-shadow-2xl'
138138
)}
139139
>

components/welcome.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function Welcome() {
5454
}, [iframeEmbedUrl]);
5555

5656
const popupTestUrl = useMemo(() => {
57-
const url = new URL('/popup', window.location.origin);
57+
const url = new URL('/test/popup', window.location.origin);
5858
return url.toString();
5959
}, []);
6060

@@ -181,7 +181,7 @@ export default function Welcome() {
181181
<p className="text-fg4 overflow-hidden text-sm text-ellipsis whitespace-nowrap">
182182
Test your latest build at{' '}
183183
<a
184-
href="/popup"
184+
href={popupTestUrl}
185185
target="_blank"
186186
rel="noopener noreferrer"
187187
className="underline"

styles/globals.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
@custom-variant dark (&:is(.dark *));
55

6-
:root {
6+
:root,
7+
:host {
78
--fg0: #000000;
89
--fg1: #3b3b3b;
910
--fg2: #4d4d4d;

webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require('path');
33
const Dotenv = require('dotenv-webpack');
44

55
module.exports = {
6+
mode: 'production',
67
entry: './components/embed-popup/standalone-bundle-root.tsx', // Input file
78
output: {
89
path: path.resolve(__dirname, 'public'),

0 commit comments

Comments
 (0)