mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 12:29:41 +02:00
Add granularity to filter widths (#2183)
This commit is contained in:
@@ -13,6 +13,8 @@ export function FilterDropdown({
|
|||||||
icon,
|
icon,
|
||||||
defaultDisplay,
|
defaultDisplay,
|
||||||
width = "w-64",
|
width = "w-64",
|
||||||
|
dropdownWidth,
|
||||||
|
optionClassName,
|
||||||
}: {
|
}: {
|
||||||
options: Option[];
|
options: Option[];
|
||||||
selected: string[];
|
selected: string[];
|
||||||
@@ -20,6 +22,8 @@ export function FilterDropdown({
|
|||||||
icon: JSX.Element;
|
icon: JSX.Element;
|
||||||
defaultDisplay: string | JSX.Element;
|
defaultDisplay: string | JSX.Element;
|
||||||
width?: string;
|
width?: string;
|
||||||
|
dropdownWidth?: string;
|
||||||
|
optionClassName?: string;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -27,16 +31,16 @@ export function FilterDropdown({
|
|||||||
dropdown={
|
dropdown={
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`
|
||||||
border
|
border
|
||||||
border-border
|
border-border
|
||||||
rounded-lg
|
rounded-lg
|
||||||
bg-background
|
bg-background
|
||||||
flex
|
flex
|
||||||
flex-col
|
flex-col
|
||||||
${width}
|
${dropdownWidth || width}
|
||||||
max-h-96
|
max-h-96
|
||||||
overflow-y-auto
|
overflow-y-auto
|
||||||
overscroll-contain`}
|
overscroll-contain`}
|
||||||
>
|
>
|
||||||
{options.map((option, ind) => {
|
{options.map((option, ind) => {
|
||||||
const isSelected = selected.includes(option.key);
|
const isSelected = selected.includes(option.key);
|
||||||
@@ -44,12 +48,14 @@ export function FilterDropdown({
|
|||||||
<div
|
<div
|
||||||
key={option.key}
|
key={option.key}
|
||||||
className={`
|
className={`
|
||||||
|
${optionClassName}
|
||||||
flex
|
flex
|
||||||
px-3
|
px-3
|
||||||
text-sm
|
text-sm
|
||||||
py-2.5
|
py-2.5
|
||||||
select-none
|
select-none
|
||||||
cursor-pointer
|
cursor-pointer
|
||||||
|
w-fit
|
||||||
text-emphasis
|
text-emphasis
|
||||||
hover:bg-hover-light
|
hover:bg-hover-light
|
||||||
${
|
${
|
||||||
@@ -76,17 +82,17 @@ export function FilterDropdown({
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`
|
||||||
flex
|
flex
|
||||||
${width}
|
${width}
|
||||||
text-sm
|
text-sm
|
||||||
px-3
|
px-3
|
||||||
py-1.5
|
py-1.5
|
||||||
rounded-lg
|
rounded-lg
|
||||||
border
|
border
|
||||||
gap-x-2
|
gap-x-2
|
||||||
border-border
|
border-border
|
||||||
cursor-pointer
|
cursor-pointer
|
||||||
hover:bg-hover-light`}
|
hover:bg-hover-light`}
|
||||||
>
|
>
|
||||||
<div className="flex-none my-auto">{icon}</div>
|
<div className="flex-none my-auto">{icon}</div>
|
||||||
{selected.length === 0 ? (
|
{selected.length === 0 ? (
|
||||||
|
@@ -447,6 +447,8 @@ export function HorizontalSourceSelector({
|
|||||||
icon={<FiMap size={16} />}
|
icon={<FiMap size={16} />}
|
||||||
defaultDisplay="Sources"
|
defaultDisplay="Sources"
|
||||||
width="w-fit max-w-24 ellipsis truncate"
|
width="w-fit max-w-24 ellipsis truncate"
|
||||||
|
dropdownWidth="max-w-36 w-fit"
|
||||||
|
optionClassName="truncate break-all ellipsis"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -465,7 +467,9 @@ export function HorizontalSourceSelector({
|
|||||||
handleSelect={(option) => handleDocumentSetSelect(option.key)}
|
handleSelect={(option) => handleDocumentSetSelect(option.key)}
|
||||||
icon={<FiBook size={16} />}
|
icon={<FiBook size={16} />}
|
||||||
defaultDisplay="Sets"
|
defaultDisplay="Sets"
|
||||||
width="w-fit max-w-24 ellipsis"
|
width="w-fit max-w-24 ellipsis truncate"
|
||||||
|
dropdownWidth="max-w-36 w-fit"
|
||||||
|
optionClassName="truncate break-all ellipsis"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -495,7 +499,9 @@ export function HorizontalSourceSelector({
|
|||||||
}}
|
}}
|
||||||
icon={<FiTag size={16} />}
|
icon={<FiTag size={16} />}
|
||||||
defaultDisplay="Tags"
|
defaultDisplay="Tags"
|
||||||
width="w-fit max-w-24 ellipsis"
|
width="w-fit max-w-24 ellipsis truncate"
|
||||||
|
dropdownWidth="max-w-80 w-fit"
|
||||||
|
optionClassName="truncate break-all ellipsis"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user