-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from commons-stack/swap
Work in progress swap front-end
- Loading branch information
Showing
4 changed files
with
203 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Divider, HStack, Text, VStack, Image, Button, InputGroup } from '@chakra-ui/react'; | ||
import { useState } from 'react'; | ||
import CustomInput from '../shared/CustomInput'; | ||
import CustomInputRightAddon from '../shared/CustomInputRightAddon'; | ||
|
||
interface SwapHomeProps { | ||
onNextButtonClick: (clicked: boolean, dao: string) => void; | ||
} | ||
|
||
export default function SwapHome({onNextButtonClick}: SwapHomeProps) { | ||
|
||
const [dao, setDao] = useState<string>(""); | ||
const [userInteracted, setUserInteracted] = useState<boolean>(false); | ||
const [completed, setCompleted] = useState<boolean>(false); | ||
|
||
const handleDaoChange = (dao: string) => { | ||
setUserInteracted(true); | ||
setDao(dao); | ||
// Verify if the name is valid | ||
|
||
setCompleted(true); | ||
} | ||
|
||
return ( | ||
<VStack bg="brand.100" pb="100px"> | ||
<VStack spacing={0}> | ||
<Text color="brand.900" fontSize="72px" fontFamily="VictorSerifTrial">Welcome to ABC Swap</Text> | ||
<Text color="brand.900" fontSize="24px" pt="32px">Lorem ipsum</Text> | ||
<Text color="brand.900" fontSize="24px">sit amet.</Text> | ||
<Divider paddingTop="48px" | ||
borderColor="brand.900" | ||
borderBottomWidth="1px" | ||
width="100%" | ||
margin="0 auto" | ||
/> | ||
</VStack> | ||
<HStack spacing={20} paddingTop="40px" > | ||
<HStack> | ||
<Image src="../../..//public/launchpad/ContinuousFunding.svg" /> | ||
<Text color="brand.900" fontSize="20px" fontWeight="500">Continuous funding</Text> | ||
</HStack> | ||
<HStack> | ||
<Image src="../../..//public/launchpad/MarketAccessibility.svg" /> | ||
<VStack spacing={0}> | ||
<Text color="brand.900" fontSize="20px">Market accessibility</Text> | ||
<Text color="brand.900" fontSize="20px">& lower volatility</Text> | ||
</VStack> | ||
</HStack> | ||
<HStack> | ||
<Image src="../../..//public/launchpad/SustainableGrowth.svg" /> | ||
<Text color="brand.900" fontSize="20px">Sustainable growth</Text> | ||
</HStack> | ||
</HStack> | ||
<VStack spacing={4} mt="100px" > | ||
<Text color="brand.900" fontSize="40px" fontFamily="VictorSerifTrial">Select your DAO</Text> | ||
<InputGroup mt="55px"> | ||
<CustomInput | ||
w="408px" | ||
rightAddon={true} | ||
placeholder="Type an organization name" | ||
value={dao ?? ''} | ||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => { | ||
handleDaoChange(e.target.value); | ||
}} | ||
/> | ||
<CustomInputRightAddon> | ||
{userInteracted ? (dao.length > 0 ? <Image src="../../../../public/Check.svg" boxSize="24px" /> : <Image src="../../../../public/Error.svg" boxSize="24px" />) : ""} | ||
</CustomInputRightAddon> | ||
</InputGroup> | ||
<Button mt="40px" onClick={() => onNextButtonClick(true, dao)} disabled={!completed} w="310px">Next</Button> | ||
</VStack> | ||
</VStack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
import { useState } from 'react' | ||
import SimpleConvert from '../components/swap/SimpleConvert' | ||
import SwapHome from '../components/swap/SwapHome'; | ||
|
||
function Swap() { | ||
export default function Swap() { | ||
|
||
return ( | ||
<> | ||
<SimpleConvert /> | ||
</> | ||
) | ||
} | ||
const [start, setStart] = useState(false); | ||
const [selectedDao, setSelectedDao] = useState<string>(""); | ||
|
||
export default Swap | ||
const handleNextButtonClick = (clicked: boolean, dao: string) => { | ||
setStart(clicked); | ||
setSelectedDao(dao); | ||
}; | ||
|
||
console.log(selectedDao); | ||
|
||
if(start) { | ||
return ( | ||
<> | ||
<SimpleConvert dao={selectedDao}/> | ||
</> | ||
) | ||
} else { | ||
return( | ||
<> | ||
<SwapHome onNextButtonClick={handleNextButtonClick} /> | ||
</> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters