style: hide cycle and module dropdown placeholder from list and kanban view. (#4044)

This commit is contained in:
Prateek Shourya 2024-03-22 18:39:06 +05:30 committed by GitHub
parent 5c7886d7f3
commit 95d2b6f1c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 11 deletions

View File

@ -41,7 +41,7 @@ export const CycleDropdown: React.FC<Props> = observer((props) => {
hideIcon = false, hideIcon = false,
onChange, onChange,
onClose, onClose,
placeholder = "Cycle", placeholder = "",
placement, placement,
projectId, projectId,
showTooltip = false, showTooltip = false,
@ -132,7 +132,7 @@ export const CycleDropdown: React.FC<Props> = observer((props) => {
variant={buttonVariant} variant={buttonVariant}
> >
{!hideIcon && <ContrastIcon className="h-3 w-3 flex-shrink-0" />} {!hideIcon && <ContrastIcon className="h-3 w-3 flex-shrink-0" />}
{BUTTON_VARIANTS_WITH_TEXT.includes(buttonVariant) && ( {BUTTON_VARIANTS_WITH_TEXT.includes(buttonVariant) && (!!selectedName || !!placeholder) && (
<span className="flex-grow truncate max-w-40">{selectedName ?? placeholder}</span> <span className="flex-grow truncate max-w-40">{selectedName ?? placeholder}</span>
)} )}
{dropdownArrow && ( {dropdownArrow && (

View File

@ -46,7 +46,7 @@ type ButtonContentProps = {
hideIcon: boolean; hideIcon: boolean;
hideText: boolean; hideText: boolean;
onChange: (moduleIds: string[]) => void; onChange: (moduleIds: string[]) => void;
placeholder: string; placeholder?: string;
showCount: boolean; showCount: boolean;
showTooltip?: boolean; showTooltip?: boolean;
value: string | string[] | null; value: string | string[] | null;
@ -75,13 +75,15 @@ const ButtonContent: React.FC<ButtonContentProps> = (props) => {
{showCount ? ( {showCount ? (
<div className="relative flex items-center gap-1 max-w-full"> <div className="relative flex items-center gap-1 max-w-full">
{!hideIcon && <DiceIcon className="h-3 w-3 flex-shrink-0" />} {!hideIcon && <DiceIcon className="h-3 w-3 flex-shrink-0" />}
<div className="max-w-40 flex-grow truncate"> {(value.length > 0 || !!placeholder) && (
{value.length > 0 <div className="max-w-40 flex-grow truncate">
? value.length === 1 {value.length > 0
? `${getModuleById(value[0])?.name || "module"}` ? value.length === 1
: `${value.length} Module${value.length === 1 ? "" : "s"}` ? `${getModuleById(value[0])?.name || "module"}`
: placeholder} : `${value.length} Module${value.length === 1 ? "" : "s"}`
</div> : placeholder}
</div>
)}
</div> </div>
) : value.length > 0 ? ( ) : value.length > 0 ? (
<div className="flex max-w-full flex-grow flex-wrap items-center gap-2 truncate py-0.5"> <div className="flex max-w-full flex-grow flex-wrap items-center gap-2 truncate py-0.5">
@ -158,7 +160,7 @@ export const ModuleDropdown: React.FC<Props> = observer((props) => {
multiple, multiple,
onChange, onChange,
onClose, onClose,
placeholder = "Module", placeholder = "",
placement, placement,
projectId, projectId,
showCount = false, showCount = false,

View File

@ -601,6 +601,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
onChange(cycleId); onChange(cycleId);
handleFormChange(); handleFormChange();
}} }}
placeholder="Cycle"
value={value} value={value}
buttonVariant="border-with-text" buttonVariant="border-with-text"
tabIndex={getTabIndex("cycle_id")} tabIndex={getTabIndex("cycle_id")}
@ -622,6 +623,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
onChange(moduleIds); onChange(moduleIds);
handleFormChange(); handleFormChange();
}} }}
placeholder="Modules"
buttonVariant="border-with-text" buttonVariant="border-with-text"
tabIndex={getTabIndex("module_ids")} tabIndex={getTabIndex("module_ids")}
multiple multiple