Skip to content

Commit 721cf51

Browse files
committed
chore: Move FileConfigTippy to common-lib, feat: SelectPicker - add support for formatCreateLabel
1 parent 996f218 commit 721cf51

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Tippy from '@tippyjs/react'
2+
3+
import { ReactComponent as ICInfoOutline } from '@Icons/ic-info-outline.svg'
4+
import { VariableType } from '@Common/CIPipeline.Types'
5+
6+
export const FileConfigTippy = ({ fileMountDir }: Pick<VariableType, 'fileMountDir'>) => (
7+
<Tippy
8+
trigger="click"
9+
arrow={false}
10+
className="default-tt w-200"
11+
content={
12+
<div className="fs-12 lh-18 flexbox-col dc__gap-2 mw-none">
13+
<p className="m-0 fw-6 cn-0">File mount path</p>
14+
<p className="m-0 cn-50 flexbox-col flex-nowrap dc__word-break">
15+
{fileMountDir}
16+
<br />
17+
<br />
18+
Ensure the uploaded file name is unique to avoid conflicts or overrides.
19+
</p>
20+
</div>
21+
}
22+
>
23+
<div className="cursor flex">
24+
<ICInfoOutline className="icon-dim-18 scn-6" />
25+
</div>
26+
</Tippy>
27+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './SystemVariableIcon'
2+
export * from './FileConfigTippy'

src/Shared/Components/SelectPicker/SelectPicker.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
207207
onCreateOption,
208208
closeMenuOnSelect = false,
209209
shouldShowNoOptionsMessage = true,
210+
formatCreateLabel,
210211
...props
211212
}: SelectPickerProps<OptionValue, IsMulti>) => {
212213
const { inputId, required, isDisabled, controlShouldRenderValue = true, value, options, getOptionValue } = props
@@ -393,6 +394,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
393394
onInputChange={onInputChange}
394395
icon={icon}
395396
showSelectedOptionIcon={shouldShowSelectedOptionIcon}
397+
formatCreateLabel={formatCreateLabel}
396398
/>
397399
</div>
398400
</ConditionalWrap>

src/Shared/Components/SelectPicker/type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
238238
* @default true
239239
*/
240240
shouldShowNoOptionsMessage?: boolean
241+
/**
242+
* Gets the label for the "create new ..." option in the menu.
243+
* @param inputValue the current input value.
244+
*/
245+
formatCreateLabel?: (inputValue: string) => ReactNode
241246
} & (IsMulti extends true
242247
? {
243248
isMulti: IsMulti | boolean

0 commit comments

Comments
 (0)