Skip to content

Commit

Permalink
chore: e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris committed Dec 12, 2023
1 parent 7e123d7 commit 5ddc404
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 189 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Button, Chip, FieldRow, FieldHint, TextInput } from '@rocket.chat/fuselage';
import { Button, Chip, FieldRow, TextInput } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { FormEvent } from 'react';
import type { ComponentProps } from 'react';
import React, { useCallback, useState } from 'react';

type DepartmentTagsProps = {
error: string;
value: string[];
onChange: (tags: string[]) => void;
};
} & ComponentProps<typeof TextInput>;

export const DepartmentTags = ({ error, value: tags, onChange }: DepartmentTagsProps) => {
const DepartmentTags = ({ error, value: tags, onChange, ...props }: DepartmentTagsProps) => {
const t = useTranslation();
const [tagText, setTagText] = useState('');

Expand All @@ -34,7 +34,8 @@ export const DepartmentTags = ({ error, value: tags, onChange }: DepartmentTagsP
error={error}
placeholder={t('Enter_a_tag')}
value={tagText}
onChange={(e: FormEvent<HTMLInputElement>) => setTagText(e.currentTarget.value)}
onChange={onChange}
{...props}
/>
<Button
disabled={Boolean(!tagText.trim()) || tags.includes(tagText)}
Expand All @@ -46,11 +47,8 @@ export const DepartmentTags = ({ error, value: tags, onChange }: DepartmentTagsP
{t('Add')}
</Button>
</FieldRow>

<FieldHint>{t('Conversation_closing_tags_description')}</FieldHint>

{tags?.length > 0 && (
<FieldRow justifyContent='flex-start'>
<FieldRow>
{tags.map((tag, i) => (
<Chip key={i} onClick={handleTagChipClick(tag)} mie={8}>
{tag}
Expand All @@ -61,3 +59,5 @@ export const DepartmentTags = ({ error, value: tags, onChange }: DepartmentTagsP
</>
);
};

export default DepartmentTags;
Loading

0 comments on commit 5ddc404

Please sign in to comment.