Skip to content

Commit

Permalink
Merge pull request #102 from devtron-labs/feat(key-value-list)/last-item
Browse files Browse the repository at this point in the history
feat: itemClassName prop for key value list
  • Loading branch information
AbhishekA1509 authored Feb 27, 2024
2 parents ce24907 + 77ea76b commit 57cca5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Shared/Components/KeyValueList/KeyValueList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const KeyValueItem = ({
keyPlaceholder,
valuePlaceholder,
index,
itemClassName,
}: KeyValueItemProps) => {
const handleKeyUpdate = (event: React.ChangeEvent<HTMLInputElement>) => {
const data = {
Expand Down Expand Up @@ -40,7 +41,7 @@ const KeyValueItem = ({
}

return (
<div className="flexbox justify-space">
<div className={`flexbox justify-space ${itemClassName || ''}`}>
<div className="pt-8 w-100">
<CustomInput
name="item-key"
Expand Down Expand Up @@ -84,6 +85,7 @@ const KeyValueList = ({
handleKeyValueChange,
isDisabled,
disabledInfo,
itemClassName,
addButtonText = TEXT_MESSAGES.ADD_BUTTON_TEXT,
keyPlaceholder = TEXT_MESSAGES.DEFAULT_KEY_PLACEHOLDER,
valuePlaceholder = TEXT_MESSAGES.DEFAULT_VALUE_PLACEHOLDER,
Expand Down Expand Up @@ -119,6 +121,7 @@ const KeyValueList = ({
keyPlaceholder={keyPlaceholder}
valuePlaceholder={valuePlaceholder}
index={index}
itemClassName={itemClassName}
/>
))}
</>
Expand Down
4 changes: 4 additions & 0 deletions src/Shared/Components/KeyValueList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export interface KeyValueListProps {
* @default - Enter Value
*/
valuePlaceholder?: string
/**
* to be applied on each item
*/
itemClassName?: string
}

export interface KeyValueItemProps extends Omit<KeyValueListProps, 'addButtonText' | 'keyValueList' | 'disabledInfo'> {
Expand Down

0 comments on commit 57cca5c

Please sign in to comment.