Press enter to add to blocklist (#3847)
* Press enter to add to blocklist * Add support for using ts-key-enum in SettingsAccountsEmailsBlocklistInput * Sort imports
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { Key } from 'ts-key-enum';
|
||||||
|
|
||||||
import { Button } from '@/ui/input/button/components/Button';
|
import { Button } from '@/ui/input/button/components/Button';
|
||||||
import { TextInput } from '@/ui/input/components/TextInput';
|
import { TextInput } from '@/ui/input/components/TextInput';
|
||||||
@ -27,6 +28,14 @@ export const SettingsAccountsEmailsBlocklistInput = ({
|
|||||||
}>({
|
}>({
|
||||||
email: '',
|
email: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
if (e.key === Key.Enter) {
|
||||||
|
updateBlockedEmailList(formValues.email);
|
||||||
|
setFormValues({ email: '' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<StyledLinkContainer>
|
<StyledLinkContainer>
|
||||||
@ -40,6 +49,7 @@ export const SettingsAccountsEmailsBlocklistInput = ({
|
|||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
fullWidth
|
fullWidth
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
/>
|
/>
|
||||||
</StyledLinkContainer>
|
</StyledLinkContainer>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user