Skip to content

Commit

Permalink
[#21] Fix padding and add value prop to Input element. Make button ty…
Browse files Browse the repository at this point in the history
…pe optional
  • Loading branch information
liamstevens111 committed Feb 21, 2023
1 parent f7fc164 commit 52197a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import styles from './Button.module.scss';

type ButtonProps = {
text: string;
type: 'button' | 'submit' | 'reset';
type?: 'button' | 'submit' | 'reset';
className?: string;
onButtonClick: () => void;
onButtonClick?: () => void;
};

function Button({ text, type, className, onButtonClick }: ButtonProps) {
Expand Down
3 changes: 1 addition & 2 deletions src/components/Input/Input.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.input {
border-radius: 12px;

background: rgba(255, 255, 255, 0.18);

color: #fff;
padding-left: 0.5rem;
}
7 changes: 4 additions & 3 deletions src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ type InputProps = {
name: string;
label: string;
type?: HTMLInputTypeAttribute;
value?: string;
className?: string;
onInputChange: (e: React.ChangeEvent<HTMLInputElement> | React.ChangeEvent<HTMLTextAreaElement>) => void;
onInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
};

function Input({ name, label, type, className, onInputChange }: InputProps) {
function Input({ name, label, type, value, className, onInputChange }: InputProps) {
return (
<>
<label className="text-white text-left block my-5">
{label}
<input name={name} type={type} className={`${styles.input} ${className}`} onChange={onInputChange} />
<input name={name} type={type} value={value} className={`${styles.input} ${className}`} onChange={onInputChange} />
</label>
</>
);
Expand Down

0 comments on commit 52197a2

Please sign in to comment.