Skip to content

Commit

Permalink
#3 Add main buttons to NavBar on Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
mopanc committed Mar 16, 2021
1 parent bedacf2 commit b90b6e4
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 82 deletions.
1 change: 1 addition & 0 deletions oficina-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.8.3",
"antd": "^4.14.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
Expand Down
48 changes: 13 additions & 35 deletions oficina-app/src/components/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,16 @@
.App {
text-align: center;
.site-layout-content {
min-height: 280px;
padding: 24px;
background: #fff;
}

.App-logo {
height: 40vmin;
pointer-events: none;
#components-layout-demo-top .logo {
float: left;
width: 120px;
height: 31px;
margin: 16px 24px 16px 0;
background: rgba(255, 255, 255, 0.3);
}

@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);
}
.ant-row-rtl #components-layout-demo-top .logo {
float: right;
margin: 16px 0 16px 24px;
}
68 changes: 25 additions & 43 deletions oficina-app/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,37 @@
import { Layout, Menu, Breadcrumb } from 'antd';
import {
DesktopOutlined,
PieChartOutlined,
FileOutlined,
TeamOutlined,
UserOutlined,
} from '@ant-design/icons';
import { Button } from 'antd';
import { DashboardOutlined, MailOutlined } from '@ant-design/icons';
import { useState } from 'react';
import './App.css';

const { Header, Content, Footer, Sider } = Layout;
const { Header, Content, Footer } = Layout;
const { SubMenu } = Menu;

function App () {
const [collapsed, setCollapsed] = useState(false);

return <Layout style={{ minHeight: '100vh' }}>
<Sider collapsible collapsed={collapsed} onCollapse={setCollapsed}>
<div className="logo" />
<Menu theme="dark" defaultSelectedKeys={['1']} mode="inline">
<Menu.Item key="1" icon={<PieChartOutlined />}>
Option 1
</Menu.Item>
<Menu.Item key="2" icon={<DesktopOutlined />}>
Option 2
</Menu.Item>
<SubMenu key="sub1" icon={<UserOutlined />} title="User">
<Menu.Item key="3">Tom</Menu.Item>
<Menu.Item key="4">Bill</Menu.Item>
<Menu.Item key="5">Alex</Menu.Item>
</SubMenu>
<SubMenu key="sub2" icon={<TeamOutlined />} title="Team">
<Menu.Item key="6">Team 1</Menu.Item>
<Menu.Item key="8">Team 2</Menu.Item>
</SubMenu>
<Menu.Item key="9" icon={<FileOutlined />}>
Files
</Menu.Item>
</Menu>
</Sider>
<Layout className="site-layout">
<Header className="site-layout-background" style={{ padding: 0 }} />
<Content style={{ margin: '0 16px' }}>
<Breadcrumb style={{ margin: '16px 0' }}>
<Breadcrumb.Item>User</Breadcrumb.Item>
<Breadcrumb.Item>Bill</Breadcrumb.Item>
</Breadcrumb>
</Content>
<Footer style={{ textAlign: 'center' }}>Ant Design ©2018 Created by Ant UED</Footer>
</Layout>
</Layout>
return <Layout className="layout">
<Header>

<Menu theme="dark" mode="horizontal" defaultSelectedKeys={['2']}>
<Button type="primary" shape="round" icon={<MailOutlined />} style={{ margin: '0 50px' }} size={10}>
Agendar Serviço
</Button>
<Button type="primary" shape="round" icon={<DashboardOutlined />} size={10}>
Administração
</Button>
</Menu>
</Header>
<Content style={{ padding: '0 50px' }}>
<Breadcrumb style={{ margin: '16px 0' }}>
<Breadcrumb.Item>Home</Breadcrumb.Item>
<Breadcrumb.Item>List</Breadcrumb.Item>
<Breadcrumb.Item>App</Breadcrumb.Item>
</Breadcrumb>
<div className="site-layout-content">Content</div>
</Content>
<Footer style={{ textAlign: 'center' }}>Ant Design ©2021 Created by Ant UED</Footer>
</Layout>
}

export default App
11 changes: 7 additions & 4 deletions oficina-app/src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
import { ConfigProvider } from 'antd';
import ptBR from 'antd/lib/locale/pt_BR';
import 'antd/dist/antd.css';

ReactDOM.render(
<React.StrictMode>
<App />
<ConfigProvider locale={ptBR}>
<App />
</ConfigProvider>
</React.StrictMode>,
document.getElementById('root')
);


);

0 comments on commit b90b6e4

Please sign in to comment.