Skip to content

Commit 6ddc600

Browse files
committed
fix: allows long argument
1 parent e95ea95 commit 6ddc600

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

packages/diracx-web-components/src/components/shared/SearchBar/SearchBar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function SearchBar<T extends string>({
160160
() => functionUsesCurrentInput(createSuggestions),
161161
[createSuggestions],
162162
);
163-
// Create a list of options based on the current tokens and data
163+
164164
useEffect(() => {
165165
async function load() {
166166
const params: CreateSuggestionsParams = {
@@ -340,15 +340,17 @@ export function SearchBar<T extends string>({
340340
display: "flex",
341341
border: "1px solid",
342342
borderColor: "grey.400",
343-
overflow: "auto",
343+
overflow: "hidden",
344344
borderRadius: 1,
345345
":focus-within": {
346346
borderColor: "primary.main",
347347
},
348348
}}
349349
data-testid="search-bar"
350350
>
351-
<Box sx={{ gap: 1, display: "flex", padding: 1, width: 0.9 }}>
351+
<Box
352+
sx={{ gap: 1, display: "flex", padding: 1, width: 1, overflow: "auto" }}
353+
>
352354
{tokenEquations.map((equation, index) => (
353355
<DisplayTokenEquation
354356
key={index}

packages/diracx-web-components/src/components/shared/SearchBar/SearchField.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ export default function SearchField({
249249
}, 0);
250250
}
251251

252-
// Calculate the width of the input field based on the input value length
253-
const width = Math.min(Math.max(inputValue.length * 8 + 50, 150), 800);
254-
255252
const handleDateAccepted = (newValue: string | null) => {
256253
if (newValue) {
257254
handleTokenCreation(
@@ -289,8 +286,7 @@ export default function SearchField({
289286
sx={{
290287
marginTop: "2px",
291288
minWidth: "180px",
292-
width: "auto",
293-
maxWidth: 0.9,
289+
flexGrow: 1,
294290
}}
295291
disableClearable={true}
296292
options={suggestions.items}
@@ -309,9 +305,6 @@ export default function SearchField({
309305
input: {
310306
...params.InputProps,
311307
disableUnderline: true,
312-
style: {
313-
width: `${width}px`,
314-
},
315308
},
316309
}}
317310
onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {

0 commit comments

Comments
 (0)