Skip to content

Commit 530a5ef

Browse files
Merge pull request #467 from thoughtspot/css-updates-in-product
theme-builder fix and light/dark mode setting for in-product presenta…
2 parents 56c0a2d + 3e413b2 commit 530a5ef

4 files changed

Lines changed: 31 additions & 64 deletions

File tree

src/assets/styles/index.scss

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ a.anchor {
11061106
box-shadow: 0 2px 2px #1B3E61;
11071107
padding: 30px 0 0 40px;
11081108

1109-
1109+
11101110
.header-banner-text {
11111111
display: flex;
11121112
flex-direction: column;
@@ -1126,6 +1126,27 @@ a.anchor {
11261126
}
11271127
}
11281128

1129+
// In-product presentation only: override banner color to match product sidebar (#232F43).
1130+
// Standalone light/dark banner gradient is preserved via var(--header-banner-background) above.
1131+
.embedded-mode .header-banner {
1132+
background: #232F43;
1133+
box-shadow: none;
1134+
}
1135+
1136+
// Fluid home page cards for both standalone and embedded presentations.
1137+
// Using flex shorthand so cards reflow naturally when the viewport or iframe width changes.
1138+
.introCard,
1139+
.boxHalfWidth {
1140+
flex: 1 1 260px;
1141+
width: auto;
1142+
max-width: 400px;
1143+
}
1144+
1145+
.boxDiv {
1146+
flex: 1 1 220px;
1147+
width: auto;
1148+
}
1149+
11291150
.cardHeading {
11301151
font-size: $font-size-h2;
11311152
color: var(--primary-color) #1d232f;

src/components/DevDocTemplate/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ const DevDocTemplate: FC<DevDocTemplateProps> = (props) => {
103103
});
104104
const [isDarkMode, setDarkMode] = useState<boolean>(() => {
105105
if (typeof window === 'undefined') return false;
106+
// In-product (embedded) presentation always uses light mode — product UI has no theme toggle.
107+
if (!isPublicSite(location.search)) return false;
106108
/* themeMode is only written when the user explicitly clicks the toggle.
107109
If absent, follow OS preference fresh every load. */
108110
const explicitChoice = localStorage.getItem('themeMode');
@@ -223,6 +225,12 @@ const DevDocTemplate: FC<DevDocTemplateProps> = (props) => {
223225

224226
useEffect(() => {
225227
if (isBrowser()) {
228+
// In-product (embedded) presentation always uses light mode.
229+
if (!isPublicSiteOpen) {
230+
setDarkMode(false);
231+
setKey('dark');
232+
return;
233+
}
226234
/* Correct SSR mismatch on first hydration */
227235
const explicitChoice = localStorage.getItem('themeMode');
228236
let isDark: boolean;

src/components/Document/__snapshots__/index.test.tsx.snap

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,6 @@ exports[`Document should render correctly if isPublicSiteOpen is false 1`] = `
66
class="documentWrapper"
77
style="width: 100%;"
88
>
9-
<div
10-
class="document-toolbar"
11-
>
12-
<div
13-
class="copy-page-dropdown"
14-
>
15-
<button
16-
aria-expanded="false"
17-
aria-haspopup="true"
18-
class="copy-page-dropdown__trigger "
19-
title="Copy or share this page"
20-
>
21-
<svg
22-
class="copy-page-icon"
23-
fill="none"
24-
height="1em"
25-
stroke="currentColor"
26-
stroke-linecap="round"
27-
stroke-linejoin="round"
28-
stroke-width="2"
29-
viewBox="0 0 24 24"
30-
width="1em"
31-
xmlns="http://www.w3.org/2000/svg"
32-
>
33-
<rect
34-
height="13"
35-
rx="2"
36-
ry="2"
37-
width="13"
38-
x="9"
39-
y="9"
40-
/>
41-
<path
42-
d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
43-
/>
44-
</svg>
45-
<span>
46-
Copy page
47-
</span>
48-
<span
49-
aria-hidden="true"
50-
class="copy-page-dropdown__trigger-divider"
51-
/>
52-
<svg
53-
class="copy-chevron"
54-
fill="none"
55-
height="1em"
56-
stroke="currentColor"
57-
stroke-linecap="round"
58-
stroke-linejoin="round"
59-
stroke-width="2"
60-
viewBox="0 0 24 24"
61-
width="1em"
62-
xmlns="http://www.w3.org/2000/svg"
63-
>
64-
<polyline
65-
points="6 9 12 15 18 9"
66-
/>
67-
</svg>
68-
</button>
69-
</div>
70-
</div>
719
<div
7210
class="documentView"
7311
id="test title"

src/components/Document/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const Document = (props: {
137137
pageid={props.pageid}
138138
/>
139139
)}
140-
{!isHomePage && (
140+
{!isHomePage && props.isPublicSiteOpen && (
141141
<div className="document-toolbar">
142142
<CopyPageDropdown pageTitle={props.docTitle} markdownBody={props.markdownBody} />
143143
</div>

0 commit comments

Comments
 (0)