diff --git a/components/Input.tsx b/components/Input.tsx new file mode 100644 index 0000000..1b9b8a0 --- /dev/null +++ b/components/Input.tsx @@ -0,0 +1,61 @@ +import React, { FC, useContext } from 'react'; +import { DarkModeContext } from '../components/DarkMode'; +import styled from 'styled-components'; + +interface Props { + placeholder?: string; + type: 'text' | 'email'; + variant: 'small' | 'big'; + name: string; + onChange?: (event: React.ChangeEvent) => void; +} + +const SmallField = styled.input<{ dark: boolean }>` + border: none; + padding: 1rem; + background: ${({ dark, theme }) => (dark ? '#2f2f2f' : theme.colors.dark.text)}; + box-shadow: ${({ dark }) => !dark && `1px 1px 10px 0px rgba(0, 0, 0, 0.15)`}; + color: ${({ dark, theme }) => (dark ? theme.colors.dark.text : theme.colors.light.text)}; +`; + +const BigField = styled.textarea<{ dark: boolean }>` + resize: none; + border: none; + padding: 1rem; + background: ${({ dark, theme }) => (dark ? '#2f2f2f' : theme.colors.dark.text)}; + box-shadow: ${({ dark }) => !dark && `1px 1px 10px 0px rgba(0, 0, 0, 0.15)`}; + color: ${({ dark, theme }) => (dark ? theme.colors.dark.text : theme.colors.light.text)}; +`; + +const Input: FC = ({ + type = 'text', + variant = 'small', + name, + placeholder, + className, + onChange +}) => { + const { dark } = useContext(DarkModeContext); + + return variant === 'small' ? ( + + ) : ( + + ); +}; + +export default Input;