Skip to content

Commit 715066b

Browse files
authored
Merge pull request #532 from devtron-labs/feat/text-area
feat: add and replace text area
2 parents e3c08ce + b53a493 commit 715066b

32 files changed

+577
-327
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.5.12",
3+
"version": "1.5.14",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Icon/ic-warning.svg

Lines changed: 1 addition & 1 deletion
Loading

src/Common/CustomTagSelector/ResizableTagTextArea.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const ResizableTagTextArea = ({
106106
onFocus?.(event)
107107
}
108108

109+
// Textarea component can't be used here
109110
return (
110111
<textarea
111112
{...restProps}

src/Common/ImageTags.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { ImageButtonType, ImageTaggingContainerType, ReleaseTag } from './ImageT
2929
import { showError, stopPropagation } from './Helper'
3030
import { setImageTags } from './Common.service'
3131
import { Progressing } from './Progressing'
32-
import { InfoIconTippy, ToastManager, ToastVariantType } from '../Shared'
32+
import { InfoIconTippy, Textarea, ToastManager, ToastVariantType } from '../Shared'
3333

3434
export const ImageTagsContainer = ({
3535
// Setting it to zero in case of external pipeline
@@ -401,24 +401,16 @@ export const ImageTagsContainer = ({
401401
Tags cannot be edited/removed later
402402
</div>
403403
)}
404-
<div className="cn-7 mt-12">Comment</div>
405-
<div
406-
className="flex left flex-wrap dc__gap-8 w-100 mt-6 mb-12"
407-
data-testid="add-image-comment-text-area"
408-
>
409-
<textarea
404+
<div className="mt-12">
405+
<Textarea
406+
label="Comment"
410407
value={newDescription}
411408
onChange={handleDescriptionChange}
412-
className="flex left flex-wrap dc__gap-8 dc__description-textarea fs-13"
413-
style={{ height: '90px !important' }}
409+
placeholder="Enter comment"
410+
name="add-image-comment-text-area"
411+
error={descriptionValidationMessage}
414412
/>
415413
</div>
416-
{descriptionValidationMessage !== '' && (
417-
<div className="flex left">
418-
<Error className="form__icon form__icon--error" />
419-
<div className="form__error">{descriptionValidationMessage}</div>
420-
</div>
421-
)}
422414
<div className="w-100 flex right mt-12">
423415
<button
424416
className="cta flex cancel h-32 lh-32-imp"

src/Common/ResizableTextarea.tsx

Lines changed: 0 additions & 89 deletions
This file was deleted.

src/Common/Types.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -800,20 +800,6 @@ export interface UseSearchString {
800800
}
801801
}
802802

803-
export interface ResizableTextareaProps {
804-
minHeight?: number
805-
maxHeight?: number
806-
value?: string
807-
onChange?: (e) => void
808-
onBlur?: (e) => void
809-
onFocus?: (e) => void
810-
className?: string
811-
placeholder?: string
812-
disabled?: boolean
813-
name?: string
814-
dataTestId?: string
815-
}
816-
817803
export interface AsyncState<T> {
818804
loading: boolean
819805
result: T

src/Common/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export * from './Policy.Types'
5050
export { default as DeleteComponent } from './DeleteComponentModal/DeleteComponent'
5151
export * from './ImageTags'
5252
export * from './ImageTags.Types'
53-
export * from './ResizableTextarea'
5453
export { default as DebouncedSearch } from './DebouncedSearch/DebouncedSearch'
5554
export { default as Grid } from './Grid/Grid'
5655
// export { default as CodeEditor } from './CodeEditor/CodeEditor'

src/Pages/GlobalConfigurations/BuildInfra/BuildInfraDescriptionField.tsx

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { FormEvent, FunctionComponent } from 'react'
18-
import { ReactComponent as ErrorIcon } from '../../../Assets/Icon/ic-warning.svg'
18+
import { Textarea } from '@Shared/Components'
1919
import { BuildInfraMetaConfigTypes, BuildInfraProfileMetaFieldProps } from './types'
2020
import { BUILD_INFRA_TEXT } from './constants'
2121

@@ -39,28 +39,14 @@ const BuildInfraProfileDescriptionField: FunctionComponent<BuildInfraProfileMeta
3939
}
4040

4141
return (
42-
<div className="flexbox-col dc__gap-4 w-100 dc__align-start">
43-
<label htmlFor="build-infra-profile-description" className="m-0 fs-13 fw-4 lh-20 cn-7">
44-
{BUILD_INFRA_TEXT.DESCRIPTION_LABEL}
45-
</label>
46-
47-
<textarea
48-
data-testid="build-infra-profile-description"
49-
name="profile-description"
50-
className="form__textarea mxh-140 dc__hover-border-n300"
51-
id="build-infra-profile-description"
52-
placeholder={BUILD_INFRA_TEXT.DESCRIPTION_PLACEHOLDER}
53-
value={currentValue}
54-
onChange={handleChange}
55-
/>
56-
57-
{error && (
58-
<div className="form__error">
59-
<ErrorIcon className="form__icon form__icon--error" />
60-
{error}
61-
</div>
62-
)}
63-
</div>
42+
<Textarea
43+
label={BUILD_INFRA_TEXT.DESCRIPTION_LABEL}
44+
name="build-infra-profile-description"
45+
placeholder={BUILD_INFRA_TEXT.DESCRIPTION_PLACEHOLDER}
46+
value={currentValue}
47+
onChange={handleChange}
48+
error={error}
49+
/>
6450
)
6551
}
6652

src/Shared/Components/Button/constants.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { ComponentSizeType } from '@Shared/constants'
17+
import { COMPONENT_SIZE_TYPE_TO_FONT_AND_BLOCK_PADDING_MAP, ComponentSizeType } from '@Shared/constants'
1818
import { ProgressingProps } from '@Common/Types'
1919
import { ButtonProps } from './types'
2020

2121
export const BUTTON_SIZE_TO_CLASS_NAME_MAP: Record<ButtonProps['size'], string> = {
22-
[ComponentSizeType.xxs]: 'px-9 py-1 fs-12 lh-20 fw-6 dc__gap-6 mw-48',
23-
[ComponentSizeType.xs]: 'px-9 py-1 fs-12 lh-20 fw-6 dc__gap-6 mw-48',
24-
[ComponentSizeType.small]: 'px-9 py-3 fs-12 lh-20 fw-6 dc__gap-8 mw-48',
25-
[ComponentSizeType.medium]: 'px-11 py-5 fs-13 lh-20 fw-6 dc__gap-8 mw-48',
26-
[ComponentSizeType.large]: 'px-13 py-7 fs-13 lh-20 fw-6 dc__gap-8 mw-64',
27-
[ComponentSizeType.xl]: 'px-15 py-9 fs-14 lh-20 fw-6 dc__gap-12 mw-64',
22+
[ComponentSizeType.xxs]: `${COMPONENT_SIZE_TYPE_TO_FONT_AND_BLOCK_PADDING_MAP[ComponentSizeType.xxs]} px-9 fw-6 dc__gap-6 mw-48`,
23+
[ComponentSizeType.xs]: `${COMPONENT_SIZE_TYPE_TO_FONT_AND_BLOCK_PADDING_MAP[ComponentSizeType.xs]} px-9 fw-6 dc__gap-6 mw-48`,
24+
[ComponentSizeType.small]: `${COMPONENT_SIZE_TYPE_TO_FONT_AND_BLOCK_PADDING_MAP[ComponentSizeType.small]} px-9 fw-6 dc__gap-8 mw-48`,
25+
[ComponentSizeType.medium]: `${COMPONENT_SIZE_TYPE_TO_FONT_AND_BLOCK_PADDING_MAP[ComponentSizeType.medium]} px-11 fw-6 dc__gap-8 mw-48`,
26+
[ComponentSizeType.large]: `${COMPONENT_SIZE_TYPE_TO_FONT_AND_BLOCK_PADDING_MAP[ComponentSizeType.large]} px-13 fw-6 dc__gap-8 mw-64`,
27+
[ComponentSizeType.xl]: `${COMPONENT_SIZE_TYPE_TO_FONT_AND_BLOCK_PADDING_MAP[ComponentSizeType.xl]} px-15 fw-6 dc__gap-12 mw-64`,
2828
} as const
2929

3030
export const ICON_BUTTON_SIZE_TO_CLASS_NAME_MAP: Record<ButtonProps['size'], string> = {

0 commit comments

Comments
 (0)