From f013ae67a7bbbf33a94ba7e2d2203a35f34346d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Longoni?= Date: Thu, 28 Sep 2023 15:44:33 -0300 Subject: [PATCH] Add Custom Contracts and Contracts section (#195) * add custom option on home * add HomeButtonHorizontal variant * refactor CustomContract component * fix layout * add dashboard page and menu * rm contract form dashboard menu and add icon * Dashboard --> Contracts * change folder name to contracts * img uppercase * add styles refactor --- public/assets/custom-contract.png | Bin 0 -> 7990 bytes src/constants/images.ts | 1 + src/constants/menu.ts | 20 ++++-- src/pages/contracts/index.tsx | 31 +++++++++ src/pages/index.tsx | 24 +++++-- .../components/HomeButton/CustomContract.tsx | 61 ++++++++++++++++++ src/view/components/HomeButton/index.tsx | 16 ++--- src/view/components/HomeButton/styled.ts | 35 ++++++++++ src/view/components/index.ts | 1 + 9 files changed, 172 insertions(+), 17 deletions(-) create mode 100644 public/assets/custom-contract.png create mode 100644 src/pages/contracts/index.tsx create mode 100644 src/view/components/HomeButton/CustomContract.tsx create mode 100644 src/view/components/HomeButton/styled.ts diff --git a/public/assets/custom-contract.png b/public/assets/custom-contract.png new file mode 100644 index 0000000000000000000000000000000000000000..02cea907ab77646c85192accb098edbf6ce14799 GIT binary patch literal 7990 zcmV-6AIac}P)dDOXOfr)mGC_QwXOgb!>gwvRtG@cKs#b7? zV|tPZXktKI1<)JwCmx=Sg=6@cHA*mJKJVU|GLMFRC@ zOYS0pTJpaE{>2H_yN$IjGn%n<V1f`B!MnEcR+fz_7r-(8-%XaVhh1Iv#u8yhxndx%wxZHvfYD?? zAbEEn&o$#Oj^z`DjrDZmFRHG(D=mm5Z!ea|v%8BHh(PeD^-3Nt0~(#!b8iwc)@qC= zs~9Uh5I}{%Dwg@y!XZzh9vrnDrxYjxmjIPLg`g{6N;{$8LDtfXPa4gK{U9}4c}AAW zOcr-BJ(v06y!VUj@$aCK(P+e$4{QxaI;r)RQWvWbu=4KT8U$up!mu`dopK(Hgp3Sf z=&%}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N!C#pv^y?`x`kfX1$}$5+V(%{m6t0w=T5J6TJA}z*)H=q{D8qR|97Fd>SWCEa@UoD ziv6$RmWGsaT48vrsW3<25~Hv+_YuwoNC|tpVn@uHT4mynINbKtXAA3J9;0{v?B$%; zdf7L8m790lA@k%e>5j6%eE0#)0ux?+Jn_rPe9?NXCek)n&c6%N{PVRCDGMTjAk5AYGSD4$h%{&{vOpN^sytu9J}rEriJDJ zB>Czj^#nR4A}v+$7+4sfxCTlaDp2i@54BMsc%C)?jnr`rSGgIxo#1k_UrFp5SSYC_ zjm}nf)>p4?ADi4ugj&-w=`Qn7941}3{y~i_*9lp z4$aJ7B7ySj8?ePiMATGpfp=Zao4(>{Tg)pRvpUi&(F8BSX18{CPcN0C9bdu&igR^D z87I(E!+Y{`Szq&o6h)#7tgr-B;?yI%6rTlwOCq*jsD`X+ z6vHVr3{Bgj_=3RM>~ z*zQAru*(KuRs-TgkK?D|$CU<)YV|>Wwl*Rfz3K6OiUgM72BEdAumT07^t03kKSd*; zQG2!oZ4mM^g{i#L51c&zA@k%{^=bkkCCb@|H9S9)?B>wOAF)Si&;kn^1l5u`y%BG) zAerXiA#(DTpE&VQSQ2>#rI|My^LxLIPVBnC7w`t}{I^;sgeoilN>cA8zxZ!Uca{z* zUv%pV$Yq2ID*3+>imDz<=Y=GuG!f{17BhSKR$;|ErYfwsoL{c~O^7Way&nb>h8PSO z!3Xc|5{&47l<);fyWlcm#HZ3Szz=lZe(y~@y = { psp22: '/assets/token.png', diff --git a/src/constants/menu.ts b/src/constants/menu.ts index a221fb84..a9f80a0e 100644 --- a/src/constants/menu.ts +++ b/src/constants/menu.ts @@ -1,7 +1,8 @@ import { LocalLibrary, SvgIconComponent, - HomeRounded + SettingsSuggestRounded, + DataArrayRounded } from '@mui/icons-material' import { ROUTES } from '@/constants/routes' @@ -15,17 +16,26 @@ export type NavLink = { } const icons = { - HomeRounded, - LocalLibrary + SettingsSuggestRounded, + LocalLibrary, + DataArrayRounded } export const MENU_ITEMS: NavLink[] = [ { id: 'home', - title: 'Home', + title: 'Contract Builder', type: 'item', url: ROUTES.HOME, - icon: icons.HomeRounded, + icon: icons.SettingsSuggestRounded, + target: true + }, + { + id: 'contracts', + title: 'Contracts', + type: 'item', + url: ROUTES.CONTRACTS, + icon: icons.DataArrayRounded, target: true }, { diff --git a/src/pages/contracts/index.tsx b/src/pages/contracts/index.tsx new file mode 100644 index 00000000..e6aae708 --- /dev/null +++ b/src/pages/contracts/index.tsx @@ -0,0 +1,31 @@ +import { Box, Link, Stack, Typography } from '@mui/material' + +export default function Contracts() { + return ( + + + Contracts + + + Sample title + + The Polkadot Contract Wizard is a non-code tool to generate, compile + and deploy smart contracts on Polkadot Ecosystem. It provides{' '} + + standard contracts based on PSP. + + + + + ) +} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 2cd389d3..cb0148c9 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,8 +1,8 @@ import Link from 'next/link' import { Stack, Typography } from '@mui/material' -import { HomeButton } from '@/components' -import { ROUTES, TOKEN_PATHS } from '@/constants/index' +import { HomeButton, HomeButtonCustom } from '@/components' +import { CUSTOM_CONTRACT, ROUTES, TOKEN_PATHS } from '@/constants/index' import { TokenType } from '@/domain' import { useNetworkAccountsContext } from '@/context/NetworkAccountsContext' import { ContractsTableWidget } from '@/view/HomeView/ContractsTableWidget' @@ -31,9 +31,9 @@ function Home() { + + Import your own contract ⚡ + + {accountConnected && } ) diff --git a/src/view/components/HomeButton/CustomContract.tsx b/src/view/components/HomeButton/CustomContract.tsx new file mode 100644 index 00000000..4eeed6f4 --- /dev/null +++ b/src/view/components/HomeButton/CustomContract.tsx @@ -0,0 +1,61 @@ +import * as React from 'react' +import { WrapperButton } from './styled' +import { Typography, Stack, ButtonProps } from '@mui/material' + +import Image from 'next/image' +interface Props extends ButtonProps { + title: string + subtitle: string + imgPath: string + imgProps: { width?: number; height?: number } +} + +export const HomeButtonCustom = (props: Props) => { + const { title, subtitle, imgProps, imgPath, ...restProps } = props + + return ( + + + + {title} + + + + {title} + + + {subtitle} + + + + + ) +} diff --git a/src/view/components/HomeButton/index.tsx b/src/view/components/HomeButton/index.tsx index d4ea834c..c7253faa 100644 --- a/src/view/components/HomeButton/index.tsx +++ b/src/view/components/HomeButton/index.tsx @@ -17,13 +17,13 @@ const WrapperButton = styled(Button)(({ theme }) => ({ color: 'white', fontSize: '1.4rem', borderRadius: '1rem', - width: '85%', + width: '100%', backgroundColor: 'transparent', display: 'flex', alignItems: 'center', margin: '0', position: 'relative', - padding: '2rem', + padding: '1.5rem', border: 'solid 1px transparent', backgroundImage: 'linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0)), linear-gradient(180deg, #B214AC, #8C7524)', @@ -52,8 +52,8 @@ export const HomeButton = (props: Props) => { return ( { {title} diff --git a/src/view/components/HomeButton/styled.ts b/src/view/components/HomeButton/styled.ts new file mode 100644 index 00000000..ef3a457c --- /dev/null +++ b/src/view/components/HomeButton/styled.ts @@ -0,0 +1,35 @@ +import { styled } from '@mui/material/styles' +import Button, { ButtonProps } from '@mui/material/Button' + +export const WrapperButton = styled(Button)(({ theme }) => ({ + color: 'white', + fontSize: '1.4rem', + borderRadius: '1rem', + width: '100%', + backgroundColor: 'transparent', + display: 'flex', + alignItems: 'center', + margin: '0', + position: 'relative', + padding: '1.5rem', + border: 'solid 1px transparent', + backgroundImage: + 'linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0)), linear-gradient(90deg, #B214AC, #2EB5FD)', + backgroundOrigin: 'border-box', + backgroundClip: 'content-box, border-box', + boxShadow: '2px 1000px 1px #0D0E13 inset', + [theme.breakpoints.down('sm')]: { + width: '100%', + margin: '0.5rem !important', + padding: '1.3rem' + }, + + '&:hover': { + backgroundImage: + 'linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0)), linear-gradient(90deg, #ffffff, #ffb7ff)', + backgroundOrigin: 'border-box', + backgroundClip: 'content-box, border-box', + boxShadow: + '2px 1000px 1px #11121a inset, 0 4px 20px 2px rgba(241, 83, 255, 0.25)' + } +})) diff --git a/src/view/components/index.ts b/src/view/components/index.ts index 0013260c..e94e1573 100644 --- a/src/view/components/index.ts +++ b/src/view/components/index.ts @@ -1,5 +1,6 @@ export * as Transitions from './Transitions' export * from './HomeButton' +export * from './HomeButton/CustomContract' export * from './LoadingButton/styled' export * from './LoadingButton' export { default as Stepper } from './StepperWrapper'