basic storybook app with a couple of component from TFE
This commit is contained in:
parent
33ad5a8ba2
commit
f2af09b9ad
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
*.swp
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
@ -18,6 +19,13 @@
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
.idea
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
.env
|
||||
|
||||
automation/.nyc_output/
|
||||
.devcontainer
|
||||
|
10
.storybook/main.js
Normal file
10
.storybook/main.js
Normal file
@ -0,0 +1,10 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
||||
addons: [
|
||||
"@storybook/addon-links",
|
||||
"@storybook/addon-essentials",
|
||||
"@storybook/preset-create-react-app",
|
||||
],
|
||||
};
|
11
.storybook/preview.js
Normal file
11
.storybook/preview.js
Normal file
@ -0,0 +1,11 @@
|
||||
import "../src/styles/index.scss";
|
||||
|
||||
export const parameters = {
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
};
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Gobalsky Labs Ltd.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
47
README.md
47
README.md
@ -1,46 +1,3 @@
|
||||
# Getting Started with Create React App
|
||||
# React utils
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `yarn start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.\
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `yarn build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `yarn eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
Shareable react components, hooks and functions for usage across Vega apps.
|
||||
|
29
package.json
29
package.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "react-utils",
|
||||
"name": "@vegaprotocol/react-utils",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
@ -10,6 +10,7 @@
|
||||
"@types/node": "^12.0.0",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"node-sass": "^5.0.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-scripts": "4.0.3",
|
||||
@ -17,15 +18,25 @@
|
||||
"web-vitals": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
"eject": "react-scripts eject",
|
||||
"storybook": "start-storybook -p 6006 -s public",
|
||||
"build-storybook": "build-storybook -s public"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"**/*.stories.*"
|
||||
],
|
||||
"rules": {
|
||||
"import/no-anonymous-default-export": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
@ -39,5 +50,13 @@
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/addon-actions": "^6.3.8",
|
||||
"@storybook/addon-essentials": "^6.3.8",
|
||||
"@storybook/addon-links": "^6.3.8",
|
||||
"@storybook/node-logger": "^6.3.8",
|
||||
"@storybook/preset-create-react-app": "^3.2.0",
|
||||
"@storybook/react": "^6.3.8"
|
||||
}
|
||||
}
|
||||
}
|
38
src/App.css
38
src/App.css
@ -1,38 +0,0 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
26
src/App.tsx
26
src/App.tsx
@ -1,26 +0,0 @@
|
||||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
51
src/components/callout/callout.scss
Normal file
51
src/components/callout/callout.scss
Normal file
@ -0,0 +1,51 @@
|
||||
@import "../../styles/colors";
|
||||
|
||||
.callout {
|
||||
display: flex;
|
||||
padding: 14px;
|
||||
border: 1px solid $white;
|
||||
box-shadow: 3px 3px 0px $white;
|
||||
|
||||
p {
|
||||
margin: 0 0 10px 0;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// VARIATIONS
|
||||
&--error {
|
||||
box-shadow: 5px 5px 0px $vega-red3;
|
||||
}
|
||||
|
||||
&--success {
|
||||
box-shadow: 5px 5px 0px $vega-green3;
|
||||
}
|
||||
|
||||
&--warn {
|
||||
box-shadow: 5px 5px 0px $vega-yellow3;
|
||||
}
|
||||
|
||||
&__content {
|
||||
> :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__title,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
margin-right: 10px;
|
||||
color: $white;
|
||||
}
|
||||
}
|
31
src/components/callout/callout.stories.tsx
Normal file
31
src/components/callout/callout.stories.tsx
Normal file
@ -0,0 +1,31 @@
|
||||
import React from "react";
|
||||
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
||||
|
||||
import { Callout } from ".";
|
||||
|
||||
export default {
|
||||
title: "Callout",
|
||||
component: Callout,
|
||||
} as ComponentMeta<typeof Callout>;
|
||||
|
||||
const Template: ComponentStory<typeof Callout> = (args) => (
|
||||
<Callout {...args}>Content</Callout>
|
||||
);
|
||||
|
||||
export const Default = Template.bind({});
|
||||
Default.args = {};
|
||||
|
||||
export const Success = Template.bind({});
|
||||
Success.args = {
|
||||
intent: "success",
|
||||
};
|
||||
|
||||
export const Error = Template.bind({});
|
||||
Error.args = {
|
||||
intent: "error",
|
||||
};
|
||||
|
||||
export const Warning = Template.bind({});
|
||||
Warning.args = {
|
||||
intent: "warn",
|
||||
};
|
24
src/components/callout/callout.tsx
Normal file
24
src/components/callout/callout.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
import "./callout.scss";
|
||||
|
||||
export const Callout = ({
|
||||
children,
|
||||
title,
|
||||
intent,
|
||||
icon,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
title?: string;
|
||||
intent?: "success" | "error" | "warn";
|
||||
icon?: React.ReactNode;
|
||||
}) => {
|
||||
const className = ["callout", intent ? `callout--${intent}` : ""].join(" ");
|
||||
return (
|
||||
<div data-testid="callout" className={className}>
|
||||
{icon && <div className="callout__icon">{icon}</div>}
|
||||
<div className="callout__content">
|
||||
{title && <h3 className="callout__title">{title}</h3>}
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
1
src/components/callout/index.ts
Normal file
1
src/components/callout/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./callout";
|
51
src/components/etherscan-link/etherscan-link.stories.tsx
Normal file
51
src/components/etherscan-link/etherscan-link.stories.tsx
Normal file
@ -0,0 +1,51 @@
|
||||
import React from "react";
|
||||
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
||||
|
||||
import { EtherscanLink } from ".";
|
||||
import { EthereumChainIds, EthereumChainNames } from "../../utils/web3";
|
||||
|
||||
export default {
|
||||
title: "EtherscanLink",
|
||||
component: EtherscanLink,
|
||||
argTypes: {
|
||||
chainId: {
|
||||
options: Object.values(EthereumChainIds),
|
||||
control: {
|
||||
type: "select", // Type 'select' is automatically inferred when 'options' is defined
|
||||
labels: EthereumChainNames,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as ComponentMeta<typeof EtherscanLink>;
|
||||
|
||||
const Template: ComponentStory<typeof EtherscanLink> = (args) => (
|
||||
<EtherscanLink {...args} />
|
||||
);
|
||||
|
||||
export const MainnetTx = Template.bind({});
|
||||
MainnetTx.args = {
|
||||
chainId: EthereumChainIds.Mainnet,
|
||||
tx: "foo",
|
||||
text: "View transaction on Etherscan",
|
||||
};
|
||||
|
||||
export const RopstenTx = Template.bind({});
|
||||
RopstenTx.args = {
|
||||
chainId: EthereumChainIds.Ropsten,
|
||||
tx: "foo",
|
||||
text: "View transaction on Etherscan",
|
||||
};
|
||||
|
||||
export const MainnetAddress = Template.bind({});
|
||||
MainnetAddress.args = {
|
||||
chainId: EthereumChainIds.Mainnet,
|
||||
address: "foo",
|
||||
text: "View transaction on Etherscan",
|
||||
};
|
||||
|
||||
export const RopstenAddress = Template.bind({});
|
||||
RopstenAddress.args = {
|
||||
chainId: EthereumChainIds.Ropsten,
|
||||
address: "foo",
|
||||
text: "View transaction on Etherscan",
|
||||
};
|
84
src/components/etherscan-link/etherscan-link.tsx
Normal file
84
src/components/etherscan-link/etherscan-link.tsx
Normal file
@ -0,0 +1,84 @@
|
||||
import { EthereumChainId } from "../../utils/web3";
|
||||
|
||||
const etherscanUrls: Record<EthereumChainId, string> = {
|
||||
"0x1": "https://etherscan.io",
|
||||
"0x3": "https://ropsten.etherscan.io",
|
||||
"0x4": "https://rinkeby.etherscan.io",
|
||||
"0x5": "https://goerli.etherscan.io",
|
||||
"0x2a": "https://kovan.etherscan.io",
|
||||
};
|
||||
|
||||
interface BaseEtherscanLinkProps {
|
||||
chainId: EthereumChainId | null;
|
||||
text?: string;
|
||||
}
|
||||
|
||||
interface EtherscanAddressLinkProps extends BaseEtherscanLinkProps {
|
||||
address: string;
|
||||
}
|
||||
|
||||
interface EtherscanTransactionLinkProps extends BaseEtherscanLinkProps {
|
||||
tx: string;
|
||||
}
|
||||
|
||||
type EtherscanLinkProps =
|
||||
| EtherscanAddressLinkProps
|
||||
| EtherscanTransactionLinkProps;
|
||||
|
||||
/**
|
||||
* Form an HTML link tag pointing to an appropriate Etherscan page
|
||||
*/
|
||||
export const EtherscanLink = ({
|
||||
chainId,
|
||||
text,
|
||||
...props
|
||||
}: EtherscanLinkProps) => {
|
||||
let hash: string;
|
||||
let txLink: string | null;
|
||||
const createLink = etherscanLinkCreator(chainId);
|
||||
|
||||
if ("tx" in props) {
|
||||
hash = props.tx;
|
||||
txLink = createLink ? createLink.tx(hash) : null;
|
||||
} else {
|
||||
hash = props.address;
|
||||
txLink = createLink ? createLink.address(hash) : null;
|
||||
}
|
||||
|
||||
const linkText = text ? text : hash;
|
||||
|
||||
// Fallback: just render the TX id
|
||||
if (!txLink) {
|
||||
return <span>{hash}</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
<a
|
||||
href={txLink}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="etherscan-link"
|
||||
>
|
||||
{linkText}
|
||||
</a>
|
||||
);
|
||||
};
|
||||
|
||||
function etherscanLinkCreator(chainId: EthereumChainId | null) {
|
||||
if (!chainId) return null;
|
||||
|
||||
const url = etherscanUrls[chainId];
|
||||
|
||||
return {
|
||||
tx: (tx: string) => {
|
||||
if (!url) return null;
|
||||
return `${url}/tx/${tx}`;
|
||||
},
|
||||
address: (address: string) => {
|
||||
if (!url) return null;
|
||||
return `${url}/address/${address}`;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
EtherscanLink.displayName = "EtherScanLink";
|
1
src/components/etherscan-link/index.ts
Normal file
1
src/components/etherscan-link/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { EtherscanLink } from "./etherscan-link";
|
@ -1,13 +0,0 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
@ -1,17 +1,5 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import * as EthereumUtils from "./utils/web3";
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
export { Callout } from "./components/callout";
|
||||
export { EtherscanLink } from "./components/etherscan-link";
|
||||
export { EthereumUtils };
|
||||
|
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
Before Width: | Height: | Size: 2.6 KiB |
1
src/react-app-env.d.ts
vendored
1
src/react-app-env.d.ts
vendored
@ -1 +0,0 @@
|
||||
/// <reference types="react-scripts" />
|
@ -1,15 +0,0 @@
|
||||
import { ReportHandler } from 'web-vitals';
|
||||
|
||||
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
BIN
src/styles/NeuePixelGrotesk-Regular.woff
Normal file
BIN
src/styles/NeuePixelGrotesk-Regular.woff
Normal file
Binary file not shown.
17
src/styles/_fonts.scss
Normal file
17
src/styles/_fonts.scss
Normal file
@ -0,0 +1,17 @@
|
||||
$font-main: "Helvetica neue", "Helvetica", arial, sans-serif;
|
||||
$font-mono: "Roboto Mono", monospace;
|
||||
$font-pixelated: NeuePixelGrotesk, "Helvetica neue", "Helvetica", arial,
|
||||
sans-serif;
|
||||
|
||||
.font-main {
|
||||
font-family: $font-main;
|
||||
}
|
||||
|
||||
.font-mono {
|
||||
font-family: $font-mono;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: NeuePixelGrotesk;
|
||||
src: url(./NeuePixelGrotesk-Regular.woff);
|
||||
}
|
6
src/styles/_reset.scss
Normal file
6
src/styles/_reset.scss
Normal file
@ -0,0 +1,6 @@
|
||||
fieldset {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
min-width: 0;
|
||||
}
|
99
src/styles/colors.scss
Normal file
99
src/styles/colors.scss
Normal file
@ -0,0 +1,99 @@
|
||||
/* === BLUEPRINT COLOR OVERRIDES === */
|
||||
$black: #000;
|
||||
$white: #fff;
|
||||
|
||||
$dark-gray1: #1f1f1f;
|
||||
$dark-gray2: #2a2a2a;
|
||||
$dark-gray3: #363636;
|
||||
$dark-gray4: #3f3f3f;
|
||||
$dark-gray5: #494949;
|
||||
|
||||
$gray1: #6e6e6e;
|
||||
$gray2: #848484;
|
||||
$gray3: #999;
|
||||
$gray4: #b5b5b5;
|
||||
$gray5: #cbcbcb;
|
||||
|
||||
$light-gray1: #d7d7d7;
|
||||
$light-gray2: #e0e0e0;
|
||||
$light-gray3: #e7e7e7;
|
||||
$light-gray4: #f0f0f0;
|
||||
$light-gray5: #f8f8f8;
|
||||
|
||||
/* === VEGA COLORS === */
|
||||
|
||||
/*
|
||||
Note: We follow blueprints color naming scheme. https://blueprintjs.com/docs/#core/colors EG:
|
||||
$color1 = Darkest
|
||||
$color2
|
||||
$color3 = Base color
|
||||
$color4
|
||||
$color5 = Lightest
|
||||
*/
|
||||
$vega-pink: #ff2d5e;
|
||||
$vega-green: #00f780;
|
||||
|
||||
$vega-green3: #26ff8a;
|
||||
$vega-red3: #ff261a;
|
||||
$vega-blue3: #48aff0;
|
||||
$vega-yellow3: #daff0d;
|
||||
$vega-orange3: #d9822b;
|
||||
$vega-yellow4: #edff22;
|
||||
|
||||
$vega-red1: darken($vega-red3, 38%);
|
||||
$vega-green1: darken($vega-green3, 38%);
|
||||
$vega-yellow1: darken($vega-yellow3, 38%);
|
||||
$vega-orange1: darken($vega-orange3, 38%);
|
||||
|
||||
/* === TEXT COLORS === */
|
||||
$text-color: #c7c7c7;
|
||||
$text-color-inverse: #1a1821;
|
||||
$text-color-deemphasise: #8a9ba8;
|
||||
$text-color-emphasise: #f5f8fa;
|
||||
$text-color-error: $vega-red3;
|
||||
|
||||
/* === BUY/SELL BUTTONS === */
|
||||
$button-sell-hover: #893939;
|
||||
$button-sell-active: #ff5e5e;
|
||||
$button-buy-hover: #0a4023;
|
||||
$button-buy-active: #00ffb2;
|
||||
|
||||
/* === MISC BLUEPRINT COLOR OVERRIDES === */
|
||||
$pt-intent-danger: $vega-red3;
|
||||
|
||||
$input-background: #3f3f3f;
|
||||
|
||||
// App background
|
||||
$pt-dark-app-background-color: $dark-gray2;
|
||||
|
||||
// Card
|
||||
$dark-card-background-color: $dark-gray2;
|
||||
|
||||
// Menu
|
||||
$dark-menu-background-color: $dark-gray2;
|
||||
|
||||
// Navbar
|
||||
$dark-navbar-background-color: $black;
|
||||
|
||||
// Popover
|
||||
$dark-popover-background-color: $dark-gray2;
|
||||
|
||||
//overlay-backdrop
|
||||
.bp3-overlay-backdrop {
|
||||
background-color: rgba(73, 73, 73, 0.7);
|
||||
}
|
||||
|
||||
// Text helpers
|
||||
.text-deemphasise {
|
||||
color: $text-color-deemphasise;
|
||||
}
|
||||
|
||||
.text-error {
|
||||
color: $text-color-error;
|
||||
}
|
||||
|
||||
// hover row
|
||||
$row-hover-background-color: $dark-gray5;
|
||||
|
||||
// backdrop
|
||||
$backdrop-black: rgba(0, 0, 0, 0.6);
|
136
src/styles/index.scss
Normal file
136
src/styles/index.scss
Normal file
@ -0,0 +1,136 @@
|
||||
@import "./colors";
|
||||
@import "./fonts";
|
||||
@import "./reset";
|
||||
|
||||
html,
|
||||
body,
|
||||
#root {
|
||||
background-color: $black;
|
||||
color: $text-color;
|
||||
font-family: $font-main;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
|
||||
@media (min-width: 960px) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
// TYPOGRAPHY
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: 500;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 15px;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
p {
|
||||
word-break: break-word;
|
||||
line-height: 1.4;
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
a,
|
||||
.link {
|
||||
text-decoration: underline;
|
||||
color: $white;
|
||||
|
||||
&:hover {
|
||||
color: $vega-yellow3;
|
||||
}
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: $text-color-deemphasise;
|
||||
}
|
||||
|
||||
.text-pixelated {
|
||||
font-family: $font-pixelated;
|
||||
}
|
||||
|
||||
// BUTTONS
|
||||
button {
|
||||
color: $black;
|
||||
background-color: $white;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
padding: 12px 32px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background-color: $light-gray3;
|
||||
}
|
||||
|
||||
&:disabled,
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&.fill {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.button-secondary {
|
||||
border: 1px solid $white;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
color: white;
|
||||
width: 100%;
|
||||
|
||||
&:hover {
|
||||
background: $dark-gray4;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: $white;
|
||||
color: $black;
|
||||
}
|
||||
}
|
||||
|
||||
&.button-link {
|
||||
display: inline;
|
||||
appearance: none;
|
||||
padding: 0;
|
||||
text-decoration: underline;
|
||||
background-color: transparent;
|
||||
color: $white;
|
||||
outline: none;
|
||||
|
||||
&--dark {
|
||||
color: $black;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: $vega-yellow4 !important;
|
||||
}
|
||||
|
||||
.invert & {
|
||||
color: $black;
|
||||
|
||||
&:hover {
|
||||
color: $black !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FORM ELEMENTS
|
||||
select,
|
||||
input[type="text"],
|
||||
input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
background-color: #3f3f3f;
|
||||
color: white;
|
||||
border: 0;
|
||||
}
|
23
src/utils/web3.ts
Normal file
23
src/utils/web3.ts
Normal file
@ -0,0 +1,23 @@
|
||||
export type EthereumChainId = "0x1" | "0x3" | "0x4" | "0x5" | "0x2a";
|
||||
export type EthereumChainName =
|
||||
| "Mainnet"
|
||||
| "Ropsten"
|
||||
| "Rinkeby"
|
||||
| "Goerli"
|
||||
| "Kovan";
|
||||
|
||||
export const EthereumChainNames: Record<EthereumChainId, EthereumChainName> = {
|
||||
"0x1": "Mainnet",
|
||||
"0x3": "Ropsten",
|
||||
"0x4": "Rinkeby",
|
||||
"0x5": "Goerli",
|
||||
"0x2a": "Kovan",
|
||||
};
|
||||
|
||||
export const EthereumChainIds: Record<EthereumChainName, EthereumChainId> = {
|
||||
Mainnet: "0x1",
|
||||
Ropsten: "0x3",
|
||||
Rinkeby: "0x4",
|
||||
Goerli: "0x5",
|
||||
Kovan: "0x2a",
|
||||
};
|
Loading…
Reference in New Issue
Block a user