Skip to content

Commit

Permalink
feat(FormField): add spacing option
Browse files Browse the repository at this point in the history
  • Loading branch information
bramvanhoutte committed Aug 9, 2020
1 parent 7c7bd05 commit a231797
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/components/FormField/FormField.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@
margin-top: 5px;
color: var(--color-neutral-6);
}

.isSpaced {
margin-bottom: 15px;
}
14 changes: 12 additions & 2 deletions src/components/FormField/FormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ type Props = {
errorMessage?: string;
className?: string;
children: ReactNode;
isSpaced: boolean;
};

const FormField: React.FC<Props> = ({ label, className, children, hint, errorMessage }: Props) => {
const mergedClassNames = classNames(cssReset.ventura, className);
const FormField: React.FC<Props> = ({
label,
className,
children,
hint,
errorMessage,
isSpaced = false,
}: Props) => {
const mergedClassNames = classNames(cssReset.ventura, className, {
[styles.isSpaced]: isSpaced,
});
return (
<div className={mergedClassNames}>
{Boolean(label) && <span className={styles.label}>{label}</span>}
Expand Down

0 comments on commit a231797

Please sign in to comment.