Skip to content

Commit 3070df5

Browse files
LineIndentAlek99
andauthored
search bar fixes (#1258)
Co-authored-by: pourhakimi <[email protected]> Co-authored-by: Alek Petuskey <[email protected]>
1 parent 880fb48 commit 3070df5

File tree

2 files changed

+117
-8
lines changed

2 files changed

+117
-8
lines changed

pcweb/components/docpage/navbar/inkeep.py

Lines changed: 116 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""UI and logic inkeep chat component."""
22

3-
from typing import List
3+
from typing import List, Any
44

55
import reflex as rx
66
from reflex.event import EventHandler
@@ -14,8 +14,6 @@ class InkeepSearchBar(rx.NoSSRComponent):
1414

1515

1616
class Search(rx.el.Div):
17-
class_name: Var[str] = "max-w-[256px] max-h-[32px]"
18-
1917
def add_imports(self):
2018
"""Add the imports for the component."""
2119
return {
@@ -124,7 +122,6 @@ def add_hooks(self):
124122
},
125123
};
126124
const searchBarProps = {
127-
stylesheetUrls: ['/inkeepstyle-docs.css'],
128125
baseSettings: {
129126
apiKey: '87b7469f79014c35a3313795088151a52de8a58a547abd16',
130127
integrationId: 'clkbf9e7e0001s601sa0ciax1',
@@ -171,7 +168,119 @@ def add_hooks(self):
171168
forcedColorMode: resolvedColorMode, // options: 'light' or dark'
172169
},
173170
theme: {
174-
stylesheetUrls: ['/inkeepstyle-docs.css'],
171+
// Add inline styles using the recommended approach from the docs
172+
styles: [
173+
{
174+
key: "custom-theme",
175+
type: "style",
176+
value: `
177+
[data-theme='light'] .ikp-search-bar__button,
178+
[data-theme='dark'] .ikp-search-bar__button {
179+
display: flex;
180+
max-height: 32px;
181+
min-height: 32px;
182+
padding: 6px;
183+
min-width: 256px;
184+
justify-content: space-between;
185+
align-items: center;
186+
border-radius: 10px;
187+
border: 1px solid var(--c-slate-5, #E0E1E6);
188+
background: var(--c-slate-1);
189+
/* Small */
190+
font-family: "Instrument Sans";
191+
font-size: 14px;
192+
font-style: normal;
193+
font-weight: 500;
194+
line-height: 20px;
195+
/* 142.857% */
196+
letter-spacing: -0.0125em;
197+
color: var(--c-slate-9, #8B8D98);
198+
/* Shadow/Large */
199+
box-shadow: 0px 24px 12px 0px rgba(28, 32, 36, 0.02), 0px 8px 8px 0px rgba(28, 32, 36, 0.02), 0px 2px 6px 0px rgba(28, 32, 36, 0.02);
200+
transition: background-color 0.1s linear, width 0s;
201+
}
202+
203+
[data-theme='light'] .ikp-search-bar__button:hover,
204+
[data-theme='dark'] .ikp-search-bar__button:hover {
205+
background-color: var(--c-slate-3, #F0F0F3);
206+
}
207+
208+
[data-theme='dark'] .ikp-modal__overlay {
209+
background: rgba(18, 17, 19, 0.50);
210+
backdrop-filter: blur(20px);
211+
}
212+
213+
@media (max-width: 80em) {
214+
[data-theme='light'] .ikp-search-bar__button,
215+
[data-theme='dark'] .ikp-search-bar__button {
216+
padding: 2px 12px;
217+
display: block;
218+
height: 32px;
219+
min-height: 32px;
220+
width: 32px;
221+
max-width: 6em;
222+
min-width: 0px;
223+
}
224+
225+
.ikp-search-bar__button {
226+
align-items: center;
227+
justify-content: center;
228+
}
229+
230+
.ikp-search-bar__kbd-wrapper,
231+
.ikp-search-bar__text {
232+
display: none;
233+
}
234+
235+
.ikp-search-bar__icon {
236+
padding: 0;
237+
margin-right: 2px;
238+
}
239+
240+
.ikp-search-bar__content-wrapper {
241+
justify-content: center;
242+
}
243+
}
244+
245+
.ikp-search-bar__icon {
246+
display: flex;
247+
}
248+
249+
.ikp-search-bar__icon svg {
250+
width: auto;
251+
}
252+
253+
.ikp-search-bar__kbd-wrapper {
254+
padding: 0px 8px;
255+
justify-content: center;
256+
align-items: center;
257+
border-radius: 4px;
258+
box-shadow: none;
259+
color: var(--c-slate-9, #8B8D98);
260+
font-family: "Instrument Sans";
261+
--ikp-colors-transparent: var(--c-slate-3, #FCFCFD);
262+
background: var(--c-slate-3, #F0F0F3) !important;
263+
font-size: 12px;
264+
font-style: normal;
265+
font-weight: 500;
266+
line-height: 20px;
267+
/* 166.667% */
268+
letter-spacing: -0.09px;
269+
}
270+
271+
.ikp-search-bar__text,
272+
.ikp-search-bar__icon {
273+
color: var(--c-slate-9, #8B8D98);
274+
font-weight: 500;
275+
}
276+
`,
277+
},
278+
{
279+
key: "google-fonts-instrument",
280+
type: "link",
281+
value: "https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;700&display=swap",
282+
},
283+
],
175284
components: {
176285
SearchBarTrigger: {
177286
defaultProps: {
@@ -180,6 +289,8 @@ def add_hooks(self):
180289
},
181290
},
182291
},
292+
// Add this to ensure CSS variables are applied
293+
varsClassName: "ikp-variables",
183294
}
184295
},
185296
searchSettings: { // optional InkeepSearchSettings

pcweb/components/docpage/navbar/search.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@
66

77
@rx.memo
88
def search_bar() -> rx.Component:
9-
return rx.box(
10-
inkeep(), class_name="w-full h-full min-w-0 max-w-[256px] max-h-[32px]"
11-
)
9+
return inkeep()

0 commit comments

Comments
 (0)