diff --git a/components/Button.tsx b/components/Button.tsx new file mode 100644 index 0000000..a4d4cf4 --- /dev/null +++ b/components/Button.tsx @@ -0,0 +1,30 @@ +import { FunctionComponent } from 'react' + +interface ButtonProps { + onClick?: (x?) => void + disabled?: boolean + className?: string +} + +const Button: FunctionComponent = ({ + children, + onClick, + disabled = false, + className, + ...props +}) => { + return ( + + ) +} + +export default Button diff --git a/components/ContributionModal.tsx b/components/ContributionModal.tsx new file mode 100644 index 0000000..1a31ea8 --- /dev/null +++ b/components/ContributionModal.tsx @@ -0,0 +1,63 @@ +import { useEffect, useState } from 'react' +import useWalletStore from '../stores/useWalletStore' +import Input from './Input' +import Button from './Button' +import Loading from './Loading' +import WalletIcon from './WalletIcon' + +const ContributionModal = () => { + const connected = useWalletStore((s) => s.connected) + const wallet = useWalletStore((s) => s.current) + + const [contributionAmount, setContributionAmount] = useState(null) + const [submitting, setSubmitting] = useState(false) + + const handleConnectDisconnect = () => { + if (connected) { + wallet.disconnect() + } else { + wallet.connect() + } + } + + const handleSetContribution = () => { + setSubmitting(true) + } + + useEffect(() => { + const submitTimer = setTimeout(() => { + setSubmitting(false) + }, 1000) + return () => clearTimeout(submitTimer) + }, [submitting]) + + return ( +
+

Plant your seed

+

Something...

+ setContributionAmount(e.target.value)} + value={contributionAmount} + className="" + /> + + {connected ? ( + + ) : ( + + )} +
+ ) +} + +export default ContributionModal diff --git a/components/Input.tsx b/components/Input.tsx new file mode 100644 index 0000000..2782f2c --- /dev/null +++ b/components/Input.tsx @@ -0,0 +1,56 @@ +interface InputProps { + type: string + value: any + onChange: (e) => void + className?: string + disabled?: boolean + [x: string]: any +} + +const Input = ({ + type, + value, + onChange, + className, + wrapperClassName = 'w-full', + disabled, + prefix, + suffix, + ...props +}: InputProps) => { + return ( +
+ {prefix ? ( +
+ {prefix} +
+ ) : null} + + {suffix ? ( + + {suffix} + + ) : null} +
+ ) +} + +export default Input diff --git a/components/Loading.tsx b/components/Loading.tsx new file mode 100644 index 0000000..0a5c1cd --- /dev/null +++ b/components/Loading.tsx @@ -0,0 +1,26 @@ +const Loading = () => { + return ( + + + + + ) +} + +export default Loading diff --git a/components/Modal.tsx b/components/Modal.tsx new file mode 100644 index 0000000..a90e573 --- /dev/null +++ b/components/Modal.tsx @@ -0,0 +1,64 @@ +import { Portal } from 'react-portal' +import { XIcon } from '@heroicons/react/outline' + +const Modal = ({ isOpen, onClose, children, hideClose = false }) => { + return ( + +
+
+ {isOpen ? ( + + ) : null} + + + + {isOpen ? ( +
+ {!hideClose ? ( +
+ +
+ ) : ( +
+ )} + {children} +
+ ) : null} +
+
+ + ) +} + +const Header = ({ children }) => { + return ( +
{children}
+ ) +} + +Modal.Header = Header + +export default Modal diff --git a/pages/index.tsx b/pages/index.tsx index 3b0ea94..7f50caa 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,13 +1,17 @@ import Notifications from '../components/Notification' import Balances from '../components/Balances' import TopBar from '../components/TopBar' +import ContributionModal from '../components/ContributionModal' const Index = () => { return ( -
+
- - + {/* + */} +
) } diff --git a/styles/index.css b/styles/index.css index b5c61c9..194d469 100644 --- a/styles/index.css +++ b/styles/index.css @@ -1,3 +1,40 @@ @tailwind base; @tailwind components; @tailwind utilities; + +/* theme */ + +:root { + --primary: theme('colors.mango-theme.yellow'); + --red: theme('colors.mango-theme.red.DEFAULT'); + --red-dark: theme('colors.mango-theme.red.dark'); + --green: theme('colors.mango-theme.green.DEFAULT'); + --green-dark: theme('colors.mango-theme.green.dark'); + --bkg-1: theme('colors.mango-theme["bkg-1"]'); + --bkg-2: theme('colors.mango-theme["bkg-2"]'); + --bkg-3: theme('colors.mango-theme["bkg-3"]'); + --fgd-1: theme('colors.mango-theme["fgd-1"]'); + --fgd-2: theme('colors.mango-theme["fgd-2"]'); + --fgd-3: theme('colors.mango-theme["fgd-3"]'); + --fgd-4: theme('colors.mango-theme["fgd-4"]'); +} + +/* base */ + +* { + @apply m-0 p-0; +} + +body { + @apply bg-th-bkg-1 text-th-fgd-1 text-base font-body tracking-wide; +} + +/* type */ + +h2 { + @apply text-xl mb-2 font-bold; +} + +p { + @apply text-th-fgd-3; +} diff --git a/tailwind.config.js b/tailwind.config.js index cab7292..dbb18af 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,6 +1,3 @@ -// const colors = require('tailwindcss/colors') -// const defaultTheme = require('tailwindcss/defaultTheme') - module.exports = { mode: 'jit', purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], @@ -19,35 +16,6 @@ module.exports = { help: 'help', }, colors: { - 'mango-orange': { - DEFAULT: '#DFAB01', - dark: '#CB9C01', - }, - 'mango-yellow': '#F2C94C', - 'mango-red': '#E54033', - 'mango-green': '#AFD803', - 'mango-dark': { - lighter: '#332F46', - light: '#262337', - DEFAULT: '#141026', - }, - 'mango-med': { - light: '#C2BDD9', - DEFAULT: '#9490A6', - dark: '#706C81', - }, - 'mango-light': { - light: '#FCFCFF', - DEFAULT: '#F0EDFF', - dark: '#B9B5CE', - }, - 'mango-grey': { - lighter: '#f7f7f7', - light: '#e6e6e6', - dark: '#092e34', - darker: '#072428', - darkest: '#061f23', - }, 'mango-theme': { yellow: '#F2C94C', red: { DEFAULT: '#E54033', dark: '#C7251A' },