1
0
mirror of https://github.com/Unleash/unleash.git synced 2026-02-04 20:10:52 +01:00
This commit is contained in:
Min Nyan Lin 2026-01-23 21:15:43 +09:00 committed by GitHub
commit 07230a1989
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { useRef, useState } from 'react';
import { InputAdornment, List, ListItemText } from '@mui/material';
import { StyledDropdownSearch } from './shared.styles';
import { StyledCheckbox, StyledListItem } from './DropdownList.styles';
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip';
function useSelectionManagement<T>(handleToggle: (value: T) => () => void) {
const listRefs = useRef<Array<HTMLInputElement | HTMLLIElement | null>>([]);
@ -46,7 +47,7 @@ function useSelectionManagement<T>(handleToggle: (value: T) => () => void) {
}
export type DropdownListProps<T> = {
options: Array<{ label: string; value: T }>;
options: Array<{ label: string; description?: string; value: T }>;
onChange: (value: T) => void;
search: {
label: string;
@ -103,6 +104,9 @@ export function DropdownList<T = string>({
<List sx={{ overflowY: 'auto' }} disablePadding>
{filteredOptions.map((option, index) => {
const labelId = `checkbox-list-label-${option.value}`;
const listItemText = (
<ListItemText id={labelId} primary={option.label} />
);
return (
<StyledListItem
@ -139,7 +143,13 @@ export function DropdownList<T = string>({
disableRipple
/>
) : null}
<ListItemText id={labelId} primary={option.label} />
{option.description ? (
<HtmlTooltip title={option.description}>
{listItemText}
</HtmlTooltip>
) : (
listItemText
)}
</StyledListItem>
);
})}

View File

@ -364,6 +364,7 @@ const CreateFeatureDialogContent = ({
(type: FeatureTypeSchema) => ({
label: type.name,
value: type.id,
description: type.description,
}),
)}
onChange={(value: any) => {