From d11e29d4f50ffdf75f6f8928b5c6c962bfa529b5 Mon Sep 17 00:00:00 2001 From: Katalina Okano Date: Mon, 21 Dec 2020 05:04:44 -0500 Subject: [PATCH] chore: remove PreauthSecretCode Signed-off-by: Katalina Okano --- .../PreauthSecretCode.spec.tsx | 37 --------------- .../PreauthSecretCode.stories.tsx | 9 ---- .../preauth-secret-code/PreauthSecretCode.tsx | 46 ------------------- .../molecules/preauth-secret-code/index.ts | 1 - .../organisms/preauth/Preauth.tsx | 10 ---- 5 files changed, 103 deletions(-) delete mode 100644 src/design-system/molecules/preauth-secret-code/PreauthSecretCode.spec.tsx delete mode 100644 src/design-system/molecules/preauth-secret-code/PreauthSecretCode.stories.tsx delete mode 100644 src/design-system/molecules/preauth-secret-code/PreauthSecretCode.tsx delete mode 100644 src/design-system/molecules/preauth-secret-code/index.ts diff --git a/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.spec.tsx b/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.spec.tsx deleted file mode 100644 index 34670a0..0000000 --- a/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.spec.tsx +++ /dev/null @@ -1,37 +0,0 @@ -jest.unmock('roleypoly/design-system/atoms/text-input'); -jest.unmock('./PreauthSecretCode'); - -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { Button } from 'roleypoly/design-system/atoms/button'; -import { FaderOpacity } from 'roleypoly/design-system/atoms/fader'; -import { TextInputWithIcon } from 'roleypoly/design-system/atoms/text-input'; -import { PreauthSecretCode } from './PreauthSecretCode'; - -const value = 'unfathomable fishy sticks'; -const onSubmit = jest.fn(); - -it('sends the secret code when submitted', () => { - const view = shallow(); - - view.find(TextInputWithIcon).simulate('change', { target: { value } }); - - view.find(Button).simulate('click'); - expect(onSubmit).toBeCalledWith(value); -}); - -it('shows the submit button when secret code is not empty', () => { - const view = shallow(); - - view.find(TextInputWithIcon).simulate('change', { target: { value } }); - - expect(view.find(FaderOpacity).props().isVisible).toBe(true); -}); - -it('hides the submit button when secret code is empty', () => { - const view = shallow(); - - view.find(TextInputWithIcon).simulate('change', { target: { value: '' } }); - - expect(view.find(FaderOpacity).props().isVisible).toBe(false); -}); diff --git a/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.stories.tsx b/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.stories.tsx deleted file mode 100644 index 1049586..0000000 --- a/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.stories.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import * as React from 'react'; -import { PreauthSecretCode } from './PreauthSecretCode'; - -export default { - title: 'Molecules/Preauth/Secret Code', - component: PreauthSecretCode, -}; - -export const SecretCode = (args) => ; diff --git a/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.tsx b/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.tsx deleted file mode 100644 index 4178cf9..0000000 --- a/src/design-system/molecules/preauth-secret-code/PreauthSecretCode.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import * as React from 'react'; -import { FiKey } from 'react-icons/fi'; -import { Button } from 'roleypoly/design-system/atoms/button'; -import { FaderOpacity } from 'roleypoly/design-system/atoms/fader'; -import { Space } from 'roleypoly/design-system/atoms/space'; -import { TextInputWithIcon } from 'roleypoly/design-system/atoms/text-input'; - -type PreauthProps = { - onSubmit: (code: string) => void; -}; - -export const PreauthSecretCode = (props: PreauthProps) => { - const [secretCode, setSecretCode] = React.useState(''); - - const handleChange = (event: React.ChangeEvent) => { - setSecretCode(event.target.value); - }; - - const handleKeyPress = (event: React.KeyboardEvent) => { - if (event.key === 'Enter') { - props.onSubmit(secretCode); - } - }; - - const handleSubmit = () => { - props.onSubmit(secretCode); - }; - - return ( -
- } - value={secretCode} - placeholder="Super secret code..." - onChange={handleChange} - onKeyDown={handleKeyPress} - /> - - 0}> - - -
- ); -}; diff --git a/src/design-system/molecules/preauth-secret-code/index.ts b/src/design-system/molecules/preauth-secret-code/index.ts deleted file mode 100644 index faee937..0000000 --- a/src/design-system/molecules/preauth-secret-code/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PreauthSecretCode'; diff --git a/src/design-system/organisms/preauth/Preauth.tsx b/src/design-system/organisms/preauth/Preauth.tsx index e415b38..cf412e7 100644 --- a/src/design-system/organisms/preauth/Preauth.tsx +++ b/src/design-system/organisms/preauth/Preauth.tsx @@ -3,9 +3,7 @@ import * as React from 'react'; import { FaDiscord } from 'react-icons/fa'; import { GuildSlug } from 'roleypoly/common/types'; import { Button } from 'roleypoly/design-system/atoms/button'; -import { Space } from 'roleypoly/design-system/atoms/space'; import { PreauthGreeting } from 'roleypoly/design-system/molecules/preauth-greeting'; -import { PreauthSecretCode } from 'roleypoly/design-system/molecules/preauth-secret-code'; import styled from 'styled-components'; export type PreauthProps = { @@ -48,14 +46,6 @@ export const Preauth = (props: PreauthProps) => { - - -

- Or, send a message saying "login" to{' '} - {props.botName || 'roleypoly'} -

- -
); };