Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Commit

Permalink
feat: add wanrning banner
Browse files Browse the repository at this point in the history
  • Loading branch information
V00D00-child committed Nov 23, 2023
1 parent dcfc90d commit dad3cd9
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 3 deletions.
16 changes: 15 additions & 1 deletion packages/site/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FunctionComponent, ReactNode, useContext } from 'react';
import styled from 'styled-components';
import { Footer, Header } from './components';
import { Footer, Header, AlertBanner, AlertType } from './components';

import { GlobalStyle } from './config/theme';
import { ToggleThemeContext } from './Root';
Expand All @@ -13,6 +13,12 @@ const Wrapper = styled.div`
max-width: 100vw;
`;

const BannerWrapper = styled.div`
padding-top: 25px;
padding-left: 5%;
padding-right: 5%;
`;

export type AppProps = {
children: ReactNode;
};
Expand All @@ -29,6 +35,14 @@ export const App: FunctionComponent<AppProps> = ({ children }) => {
<GlobalStyle />
<Wrapper>
<Header handleToggleClick={toggleTheme} />
<BannerWrapper>
<AlertBanner
title={
`This software is in the early stages of development and may contain bugs, vulnerabilities and has not undergone a security audit. DO NOT use it to store real assets.`
}
alertType={AlertType.Failure}
/>
</BannerWrapper>
{children}
<Footer />
</Wrapper>
Expand Down
88 changes: 88 additions & 0 deletions packages/site/src/components/AlertBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import React from 'react';
import {
BsFillCheckCircleFill,
BsFillExclamationTriangleFill,
} from 'react-icons/bs';
import styled from 'styled-components';

const StyledAlertContainer = styled.div`
background-color: ${({ error }: { error?: boolean }) =>
error ? '#f8ebed' : '#ebf6ed'};
width: 100%;
height: 40px;
margin: 10px 0px 10px 0px;
border-radius: 4px;
display: flex;
flex-direction: row;
${({ theme }) => theme.mediaQueries.medium} {
height: 50px;
}
${({ theme }) => theme.mediaQueries.small} {
height: 145px;
}
`;

const Side = styled.div`
min-width: 5px;
max-width: 5px;
height: 100%;
background-color: ${({ error }: { error?: boolean }) =>
error ? '#d73847' : '#28a745'};
border-radius: 4px 0px 0px 4px;
flex: 1;
`;

const AlertIcon = styled(BsFillExclamationTriangleFill)`
margin: 13px 5px 13px 8px;
color: #d73847;
`;

const CheckIcon = styled(BsFillCheckCircleFill)`
margin: 13px 5px 13px 8px;
color: #28a745;
`;

const StyledTitle = styled.p`
margin: 10px 5px;
color: black;
/* Body-LG-Medium */
font-size: 16px;
font-style: normal;
font-weight: 500;
line-height: 24px; /* 150% */
`;

export enum AlertType {
Success = 'success',
Failure = 'failure',
}

export const AlertBanner = ({
title,
alertType,
}: {
title: string;
alertType: AlertType;
}) => {
const icon = () => {
switch (alertType) {
case AlertType.Failure:
return <AlertIcon />;
case AlertType.Success:
return <CheckIcon />;
default:
return null;
}
};

return (
<StyledAlertContainer error={alertType === AlertType.Failure}>
<Side error={alertType === AlertType.Failure} />
{icon()}
<StyledTitle>{title}</StyledTitle>
</StyledAlertContainer>
);
};
1 change: 1 addition & 0 deletions packages/site/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export * from './Network';
export * from './Faq';
export * from './Transaction';
export * from './ConnectToggle';
export * from './AlertBanner';
4 changes: 2 additions & 2 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ const Index = () => {
description: 'Features:',
listItems: [
'Access and control smart accounts with MetaMask. Enjoy smart contract functionality with ease and convenience.',
'Manage ERC-4337 accounts(create, sign, send, transfer funds)',
'Manage stake and deposit with supported entrypoint contracts',
'Manage ERC-4337 accounts(create, delete, send funds)',
'Manage stake, withdraws and deposits with supported entrypoint contracts',
],
button: <ConnectSnapButton onClick={handleReConnectSnapClick}/>
}}
Expand Down

0 comments on commit dad3cd9

Please sign in to comment.