Skip to content

Commit

Permalink
feat(project): layout and miragejs implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Eduardo committed Nov 21, 2020
1 parent c4a26ef commit c214e31
Show file tree
Hide file tree
Showing 39 changed files with 1,514 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugin": [
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
Expand All @@ -13,7 +13,7 @@
{
"path": "@semantic-release/git",
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skyp ci]\n\n${nextRelease.notes}"
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
}
449 changes: 449 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"polished": "^4.0.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0"
"react-icons": "^3.11.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
Expand All @@ -17,6 +21,9 @@
"@types/node": "^12.19.6",
"@types/react": "^16.9.56",
"@types/react-dom": "^16.9.9",
"@types/react-icons": "^3.0.0",
"@types/react-router-dom": "^5.1.6",
"@types/styled-components": "^5.1.4",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"cz-conventional-changelog": "^3.3.0",
Expand All @@ -28,6 +35,7 @@
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5",
"miragejs": "^0.1.41",
"prettier": "^2.1.2",
"semantic-release": "^17.2.4",
"typescript": "^4.1.2"
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
29 changes: 3 additions & 26 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<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/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>

<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

13 changes: 13 additions & 0 deletions src/@layout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Container, Header, Main, Footer } from './styles';

const Layout: React.FC = ({ children }) => (
<Container>
<Header />

<Main>{children}</Main>

<Footer />
</Container>
);

export { Layout };
41 changes: 41 additions & 0 deletions src/@layout/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import styled from 'styled-components';

export const Container = styled.div`
display: grid;
width: 100%;
height: 100%;
grid-template-columns: 1fr;
grid-template-rows: 8rem auto 4rem;
grid-template-areas:
'HEADER'
'MAIN'
'FOOTER';
`;

export const Header = styled.div`
display: flex;
grid-area: HEADER;
background-color: #3c3845;
box-shadow: -1rem -0.7rem 1.4rem #3778cd;
`;

export const Main = styled.div`
grid-area: MAIN;
width: 100%;
max-width: 1150rem;
min-width: 100vw;
padding: 2rem 4rem;
`;

export const Footer = styled.div`
display: flex;
grid-area: FOOTER;
background-color: #3c3845;
`;
3 changes: 3 additions & 0 deletions src/@types/miragejs/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'miragejs' {
function createServer(obj: any): void;
}
19 changes: 16 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import { AppProvider } from './contextApi';

import GlobalStyle from './styles/GlobalStyle';

import { Layout } from './@layout';

import Routes from './routes';

import './miragejs';

function App() {
return (
<div className="App">
<h1>Projeto Strategy</h1>
</div>
<AppProvider>
<GlobalStyle />
<Layout>
<Routes />
</Layout>
</AppProvider>
);
}

Expand Down
7 changes: 7 additions & 0 deletions src/components/ButtonAction/IButtonAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IconType } from 'react-icons';

export interface IButtonActionProps {
Icon?: IconType;
text: string;
callback: () => void;
}
13 changes: 13 additions & 0 deletions src/components/ButtonAction/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IButtonActionProps } from './IButtonAction';

import { Container } from './styles';

const ButtonAction = ({ Icon, text, callback }: IButtonActionProps) => {
return (
<Container onClick={callback}>
{Icon && <Icon />} <span>{text}</span>
</Container>
);
};

export { ButtonAction };
46 changes: 46 additions & 0 deletions src/components/ButtonAction/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import styled from 'styled-components';
import { shade } from 'polished';

const buttonColor = '#3778cd';

export const Container = styled.button`
display: flex;
align-items: center;
justify-content: center;
width: 100%;
max-width: 250px;
height: 60px;
background-color: ${buttonColor};
border-radius: 0.4rem;
border: 0;
transition: background-color 0.2s ease-in-out;
cursor: pointer;
svg {
margin-right: 1rem;
width: 2.5rem;
height: 2.5rem;
color: #fff;
}
span {
font-size: 2.2rem;
color: #fff;
}
&:hover {
background-color: ${shade(0.2, buttonColor)};
}
@media (max-width: 768px) {
span {
font-size: 1.8rem;
}
}
`;
8 changes: 8 additions & 0 deletions src/components/Input/IInput.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface IContainerProps {
isError: boolean;
}

export default interface IInput
extends React.InputHTMLAttributes<HTMLInputElement> {
isError?: boolean;
}
15 changes: 15 additions & 0 deletions src/components/Input/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';

import IInput from './IInput';

import { Container } from './styles';

const Input = ({ isError = false, ...rest }: IInput) => {
return (
<Container isError={isError}>
<input {...rest} />
</Container>
);
};

export { Input };
41 changes: 41 additions & 0 deletions src/components/Input/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import styled from 'styled-components';

import { IContainerProps } from './IInput';

export const Container = styled.div<IContainerProps>`
width: 100%;
height: 40px;
background-color: transparent;
border-bottom: 2px solid
${({ isError }) =>
isError ? 'rgba(255, 0, 0, 0.6)' : 'rgba(0, 0, 0, 0.6)'};
input {
width: 100%;
height: 100%;
background-color: transparent;
border: none;
color: rgba(0, 0, 0, 0.6);
&::placeholder {
font-size: 1.2rem;
transition: font-size 0.2s ease-in;
}
&:focus::placeholder {
font-size: 1.6rem;
}
&:disabled {
color: rgba(0, 0, 0, 0.3);
&::placeholder {
color: rgba(0, 0, 0, 0.3);
}
}
}
`;
30 changes: 30 additions & 0 deletions src/components/Table/ITable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export interface IContainerProps {
isStriped?: boolean;
isBordered?: boolean;
isHovered?: boolean;
isSmall?: boolean;
}

export interface ITHeadProps {
isBordered?: boolean;
isSmall?: boolean;
}

export interface ITBodyProps {
isStriped?: boolean;
isBordered?: boolean;
isHovered?: boolean;
isSmall?: boolean;
}

export interface ITableProps {
columns: {
label: string;
row: string;
}[];
rows: any[];
isStriped?: boolean;
isBordered?: boolean;
isHovered?: boolean;
isSmall?: boolean;
}
Loading

0 comments on commit c214e31

Please sign in to comment.