Skip to content

Commit

Permalink
feat: ecosystem layout
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtiti committed Jul 16, 2024
1 parent 35621eb commit 0d1a4c1
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const SearchBar = () => {
return (
<form>
<input type='text' placeholder='Search...' />
</form>
);
};
28 changes: 28 additions & 0 deletions src/components/Table.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useData } from '~/hooks';

export const Table = () => {
const { ecosystemData } = useData();
return (
<table>
<tr>
<th>Chain</th>
<th>Chain ID</th>
<th>Native token</th>
<th>TVL - L1</th>
<th>Type</th>
</tr>

{ecosystemData?.chains.map((data, index) => {
return (
<tr key={index}>
<td>{data.name}</td>
<td>{data.id}</td>
<td>{data.nativeToken}</td>
<td>{data.tvl}</td>
<td>{data.type}</td>
</tr>
);
})}
</table>
);
};
10 changes: 10 additions & 0 deletions src/components/TitleBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const TitleBanner = () => {
return (
<div>
<span>zkSync Ecosystem</span>
<div>
<span>Gas Price: 10 wei · ERC-20 Transfer: $10</span>
</div>
</div>
);
};
21 changes: 21 additions & 0 deletions src/components/TotalValueLocked.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export interface TokenValueLocked {
token: string;
value: number;
}

interface TotalValueLockedProps {
tvl: { [token: string]: number }[];
}

export const TotalValueLocked = ({ tvl }: TotalValueLockedProps) => {
return (
<div>
{tvl.map((data, index) => (
<div key={index}>
<span>{data.token}</span>
<span>{data.value}</span>
</div>
))}
</div>
);
};
3 changes: 3 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export * from './Theme';
export * from './Disclaimer';
export * from './CustomHead';
export * from './Table';
export * from './SearchBar';
export * from './TotalValueLocked';
15 changes: 15 additions & 0 deletions src/containers/Dashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { SearchBar, Table } from '~/components';

const Dashboard = () => {
return (
<div>
<div>
<h1>Chain list</h1>
<SearchBar />
</div>
<Table />
</div>
);
};

export default Dashboard;
9 changes: 6 additions & 3 deletions src/containers/Landing/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { styled } from '@mui/material/styles';

import { DISCLAIMER_HEIGHT, SURROUND_HEIGHT } from '~/utils';
import Dashboard from '../Dashboard';
import { LockedAssets } from '../LockedAssets';
import { TitleBanner } from '~/components/TitleBanner';

export const Landing = () => {
return (
<LandingContainer>
<h1 data-testid='boilerplate-title'>Web3 React Boilerplate</h1>
<TitleBanner />
<LockedAssets />
<Dashboard />
</LandingContainer>
);
};

const LandingContainer = styled('div')({
display: 'flex',
flexDirection: 'column',
height: `calc(100vh - ${SURROUND_HEIGHT}rem - ${DISCLAIMER_HEIGHT}rem)`,
padding: '0 8rem',
alignItems: 'center',
justifyContent: 'center',
Expand Down
17 changes: 17 additions & 0 deletions src/containers/LockedAssets/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { TotalValueLocked } from '~/components';
import { useData } from '~/hooks';

export const LockedAssets = () => {
const { ecosystemData } = useData();

return (
<div>
{ecosystemData && (
<>
<h2>Locked assets in shared bridge: {ecosystemData.total}</h2>
<TotalValueLocked tvl={ecosystemData.tvl} />
</>
)}
</div>
);
};
1 change: 1 addition & 0 deletions src/containers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './Footer';
export * from './Header';
export * from './Layout';
export * from './Landing';
export * from './Dashboard';
1 change: 1 addition & 0 deletions src/data/ecosystemMockData.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"type": "Validium"
}
],
"total": 7000000,
"tvl": [
{
"token": "ETH",
Expand Down
5 changes: 2 additions & 3 deletions src/types/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ export interface EcosystemChainData {
name: string;
id: number;
nativeToken: string;
tvl: {
[token: string]: number;
};
tvl: number;
type: string;
}

export interface EcosystemData {
chains: EcosystemChainData[];
total: number;
tvl: {
[token: string]: number;
}[];
Expand Down

0 comments on commit 0d1a4c1

Please sign in to comment.