Skip to content

Commit

Permalink
feat: add SwapButton, small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Jan 24, 2022
1 parent 54ef854 commit dad26dc
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 118 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
build
**/*.d.ts
**/*.d.ts
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/explicit-module-boundary-types": "off"
}
}
}
3 changes: 2 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />

<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand All @@ -21,4 +22,4 @@
<div id="root"></div>
</body>

</html>
</html>
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

8 changes: 7 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import './App.css';
import { SwapPage } from './pages/SwapPage';

const theme = createTheme({
palette: {
primary: {
main: '#3F49E1',
light: '#ACBEFF'
},
secondary: {
main: '#F5B5FF'
}
},
});

Expand Down
8 changes: 8 additions & 0 deletions src/components/SwapButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Button from '@mui/material/Button';
import { styled } from '@mui/material/styles';

export const SwapButton = styled(Button)({
textTransform: 'none',
borderRadius: 0,
padding: '12px 16px'
});
5 changes: 3 additions & 2 deletions src/i18n/en/translation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"swap": {
"header": "Swap"
"header": "Swap",
"button": "Swap"
}
}
}
2 changes: 1 addition & 1 deletion src/i18n/react-i18next.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ declare module 'react-i18next' {
interface CustomTypeOptions {
resources: typeof resources['en'];
}
}
}
11 changes: 6 additions & 5 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
html,
body,
#root {
height: 100%;
}

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
Expand All @@ -6,8 +12,3 @@ body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
7 changes: 6 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/utils';
import React from 'react';
import ReactDOM from 'react-dom';
import { App } from './App';
import './i18n';
import './index.css';
import { reportWebVitals } from './reportWebVitals';

ClassNameGenerator.configure((componentName) => componentName.replace('Mui', ''));

const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error('Failed to find the root element.');
Expand All @@ -20,4 +23,6 @@ root.render(
// 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();
if (process.env.NODE_ENV === 'development') {
reportWebVitals(console.log);
}
13 changes: 10 additions & 3 deletions src/pages/SwapPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { Box, Container } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { SwapButton } from '../components/SwapButton';

export function SwapPage() {
const { t } = useTranslation();
return (
<div>
{t(`swap.header`)}
</div>
<Container maxWidth="sm" sx={{ height: '100%' }}>
<Box>{t(`swap.header`)}</Box>
<Box>
<SwapButton variant="contained" disableElevation fullWidth>
{t(`swap.button`)}
</SwapButton>
</Box>
</Container>
);
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
"include": [
"src"
]
}
}
Loading

0 comments on commit dad26dc

Please sign in to comment.