Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/InputBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import type { InputBoxProps } from '@/types/components/InputBoxPropsType';
/**
* This component renders input box.
*/
export default function InputBox({ inputType, inputName, placeholder, inputValue, setInput }: InputBoxProps) {
export default function InputBox({ inputType, inputName, placeholder, inputValue, setInput, dark = false }: InputBoxProps) {
return (
<input
type={inputType}
name={inputName}
placeholder={placeholder}
value={inputValue}
onChange={(e) => setInput(e.target.value)}
className='form-input mt-2 block w-full rounded-md sm:text-sm sm:leading-5 md:mt-0 md:flex-1'
className={`form-input mt-2 block w-full rounded-md sm:text-sm sm:leading-5 md:mt-0 md:flex-1 ${
dark ? 'border-zinc-700 bg-zinc-900 text-white placeholder-zinc-500 focus:border-indigo-500 focus:ring-indigo-500' : 'border-gray-300 text-gray-900'
}`}
required
data-testid={`NewsletterSubscribe-${inputType}-input`}
/>
Expand Down
2 changes: 2 additions & 0 deletions components/NewsletterSubscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ export default function NewsletterSubscribe({
placeholder={ready ? t('nameInput') : 'Your name'}
inputValue={name}
setInput={setName}
dark={dark}
/>
<InputBox
inputType={InputTypes.EMAIL}
inputName='email'
placeholder={ready ? t('emailInput') : 'Your email'}
inputValue={email}
setInput={setEmail}
dark={dark}
/>
<Button
type={ButtonType.SUBMIT}
Expand Down
3 changes: 3 additions & 0 deletions types/components/InputBoxPropsType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ export interface InputBoxProps {

/** The function to set value of the input. */
setInput: (value: string) => void;

/** If true, the theme of the component will be dark. */
dark?: boolean;
}
Loading