Skip to content

Commit

Permalink
feat: create components
Browse files Browse the repository at this point in the history
dashboard, header, summary and transactions table
  • Loading branch information
robsonnatanael committed Apr 3, 2022
1 parent cc8071c commit 1dcac30
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .eslintcache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx":"1","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx":"2","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts":"3"},{"size":201,"mtime":1648689900760,"results":"4","hashOfConfig":"5"},{"size":176,"mtime":1648774553638,"results":"6","hashOfConfig":"5"},{"size":888,"mtime":1648776587208,"results":"7","hashOfConfig":"5"},{"filePath":"8","messages":"9","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"10"},"16wifw6",{"filePath":"11","messages":"12","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"10"},{"filePath":"13","messages":"14","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx",[],["15","16"],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts",[],{"ruleId":"17","replacedBy":"18"},{"ruleId":"19","replacedBy":"20"},"no-native-reassign",["21"],"no-negated-in-lhs",["22"],"no-global-assign","no-unsafe-negation"]
[{"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx":"1","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx":"2","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts":"3","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/index.tsx":"4","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/styles.ts":"5","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/index.tsx":"6","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/styles.ts":"7","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/index.tsx":"8","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/styles.ts":"9","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/index.tsx":"10","/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/styles.ts":"11"},{"size":201,"mtime":1648689900760,"results":"12","hashOfConfig":"13"},{"size":262,"mtime":1648938300862,"results":"14","hashOfConfig":"13"},{"size":909,"mtime":1648944108002,"results":"15","hashOfConfig":"13"},{"size":324,"mtime":1648779011418,"results":"16","hashOfConfig":"13"},{"size":543,"mtime":1648943023772,"results":"17","hashOfConfig":"13"},{"size":263,"mtime":1648947003732,"results":"18","hashOfConfig":"13"},{"size":145,"mtime":1648937924902,"results":"19","hashOfConfig":"13"},{"size":800,"mtime":1648943380912,"results":"20","hashOfConfig":"13"},{"size":632,"mtime":1648943356142,"results":"21","hashOfConfig":"13"},{"size":761,"mtime":1648948102072,"results":"22","hashOfConfig":"13"},{"size":638,"mtime":1648948051382,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"16wifw6",{"filePath":"27","messages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"33","messages":"34","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"37","messages":"38","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"41","messages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"43","messages":"44","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"45","messages":"46","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/index.tsx",[],["47","48"],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/App.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/styles/global.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Header/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Dashboard/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/Summary/styles.ts",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/index.tsx",[],"/home/robsonnatanael/develop/ignite/chapter-II/dtmoney/src/components/TransactionsTable/styles.ts",[],{"ruleId":"49","replacedBy":"50"},{"ruleId":"51","replacedBy":"52"},"no-native-reassign",["53"],"no-negated-in-lhs",["54"],"no-global-assign","no-unsafe-negation"]
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<title>dtmoney</title>

<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap"
rel="stylesheet"
/>
</head>
Expand Down
9 changes: 6 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Dashboard } from "./components/Dashboard";
import { Header } from "./components/Header";
import { GlobalStyle } from "./styles/global";

export function App() {
return (
<div className="App">
<h1>Hello World</h1>
<>
<Header />
<Dashboard />
<GlobalStyle />
</div>
</>
);
}
13 changes: 13 additions & 0 deletions src/components/Dashboard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Summary } from "../Summary";
import { TransactionsTable } from "../TransactionsTable";

import { Container } from "./styles";

export function Dashboard() {
return (
<Container>
<Summary />
<TransactionsTable />
</Container>
);
}
7 changes: 7 additions & 0 deletions src/components/Dashboard/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from "styled-components";

export const Container = styled.main`
max-width: 1120px;
margin: 0 auto;
padding: 2.5rem 1rem;
`;
15 changes: 15 additions & 0 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import logoImg from '../../assets/logo.svg';
import { Container, Content } from './styles';

export function Header() {
return (
<Container>
<Content>
<img src={logoImg} alt="dt money" />
<button type="button">
Nova transação
</button>
</Content>
</Container>
)
}
29 changes: 29 additions & 0 deletions src/components/Header/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import styled from "styled-components";

export const Container = styled.header`
background: var(--blue);
`;

export const Content = styled.div`
max-width: 1120px;
margin: 0 auto;
padding: 2rem 1rem 12rem;
display: flex;
align-items: center;
justify-content: space-between;
button {
font-size: 1rem;
color: #fff;
background: var(--blue-light);
border: 0;
padding: 0 2rem;
border-radius: 0.25rem;
height: 3rem;
transition: filter 0.2s;
&:hover {
filter: brightness(0.9);
}
}
`;
33 changes: 33 additions & 0 deletions src/components/Summary/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import incomeImg from '../../assets/income.svg';
import outcomeImg from '../../assets/outcome.svg';
import totalImg from '../../assets/total.svg';

import { Container } from "./styles";

export function Summary() {
return (
<Container>
<div>
<header>
<p>Entradas</p>
<img src={incomeImg} alt="Entradas" />
</header>
<strong>R$1000,00</strong>
</div>
<div>
<header>
<p>Saídas</p>
<img src={outcomeImg} alt="Saídas" />
</header>
<strong>-R$500,00</strong>
</div>
<div className="highlight-background">
<header>
<p>Total</p>
<img src={totalImg} alt="Total" />
</header>
<strong>R$500,00</strong>
</div>
</Container>
);
}
34 changes: 34 additions & 0 deletions src/components/Summary/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import styled from "styled-components";

export const Container = styled.div`
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 2rem;
margin-top: -10rem;
div {
background: var(--shape);
padding: 1.5rem 2rem;
border-radius: 0.25rem;
color: var(--text-title);
header {
display: flex;
align-items: center;
justify-content: space-between;
}
strong {
display: block;
margin-top: 1rem;
font-size: 2rem;
font-weight: 500;
line-height: 3rem;
}
&.highlight-background {
background: var(--green);
color: #fff;
}
}
`;
32 changes: 32 additions & 0 deletions src/components/TransactionsTable/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Container } from "./styles";

export function TransactionsTable() {
return (
<Container>
<table>
<thead>
<tr>
<th>Título</th>
<th>Valor</th>
<th>Categoria</th>
<th>Data</th>
</tr>
</thead>
<tbody>
<tr>
<td>Desenvolvimento de website</td>
<td className="deposit">R$12.000</td>
<td>Desenvolvimento</td>
<td>02/04/2022</td>
</tr>
<tr>
<td>Financiamento Imobiliário</td>
<td className="withdraw">- R$700</td>
<td>Financiamento</td>
<td>05/04/2022</td>
</tr>
</tbody>
</table>
</Container>
);
}
38 changes: 38 additions & 0 deletions src/components/TransactionsTable/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import styled from "styled-components";

export const Container = styled.div`
margin-top: 4rem;
table {
width: 100%;
border-spacing: 0 0.5rem;
th {
color: var(--text-body);
font-weight: 400;
padding: 1rem 2rem;
text-align: left;
line-height: 1.5rem;
}
td {
padding: 1rem 2rem;
border: 0;
background: var(--shape);
color: var(--text-body);
border-radius: 0.25px;
&:first-child {
color: var(--text-title);
}
&.deposit {
color: var(--green);
}
&.withdraw {
color: var(--red);
}
}
}
`;
1 change: 1 addition & 0 deletions src/styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const GlobalStyle = createGlobalStyle`
:root {
--background: #f0f2f5;
--red: #e52e4d;
--green: #33cc95;
--blue: #5429cc;
--blue-light: #6933ff;
Expand Down

0 comments on commit 1dcac30

Please sign in to comment.