Skip to content

Commit

Permalink
fix: antd design
Browse files Browse the repository at this point in the history
  • Loading branch information
adityak74 committed Oct 23, 2021
1 parent 3d72e3f commit fc0e53c
Show file tree
Hide file tree
Showing 6 changed files with 611 additions and 236 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/jest-dom": "4.2.4",
"@testing-library/react": "9.3.2",
"@testing-library/user-event": "7.1.2",
"antd": "4.16.13",
"mini-svg-data-uri": "1.4.3",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down Expand Up @@ -42,7 +43,9 @@
"@babel/preset-react": "7.14.5",
"babel-loader": "8.2.2",
"html-webpack-plugin": "5.4.0",
"style-loader": "3.3.1",
"svg-inline-loader": "0.8.2",
"url-loader": "4.1.1",
"webpack": "5.59.0",
"webpack-cli": "4.9.1",
"webpack-dev-server": "4.3.1"
Expand Down
6 changes: 4 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import React from 'react';
import logo from './logo.svg';
import { Counter } from './features/counter/Counter';
import MainLayout from './components/Layout';
import './App.css';

function App() {
return (
<div className="App">
<header className="App-header">
{/* <header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<Counter />
</header>
</header> */}
<MainLayout />
</div>
);
}
Expand Down
65 changes: 65 additions & 0 deletions src/components/Layout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import React from 'react';
import 'antd/dist/antd.css';
import { Layout, Menu } from 'antd';
import {
MenuUnfoldOutlined,
MenuFoldOutlined,
UserOutlined,
VideoCameraOutlined,
UploadOutlined,
} from '@ant-design/icons';

const { Header, Sider, Content } = Layout;

class MainLayout extends React.Component {
state = {
collapsed: false,
};

toggle = () => {
this.setState({
collapsed: !this.state.collapsed,
});
};

render() {
return (
<Layout>
<Sider trigger={null} collapsible collapsed={this.state.collapsed}>
<div className="logo" />
<Menu theme="dark" mode="inline" defaultSelectedKeys={['1']}>
<Menu.Item key="1" icon={<UserOutlined />}>
nav 1
</Menu.Item>
<Menu.Item key="2" icon={<VideoCameraOutlined />}>
nav 2
</Menu.Item>
<Menu.Item key="3" icon={<UploadOutlined />}>
nav 3
</Menu.Item>
</Menu>
</Sider>
<Layout className="site-layout">
<Header className="site-layout-background" style={{ padding: 0 }}>
{React.createElement(this.state.collapsed ? MenuUnfoldOutlined : MenuFoldOutlined, {
className: 'trigger',
onClick: this.toggle,
})}
</Header>
<Content
className="site-layout-background"
style={{
margin: '24px 16px',
padding: 24,
minHeight: 280,
}}
>
Content
</Content>
</Layout>
</Layout>
);
}
}

export default MainLayout;
22 changes: 22 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,25 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

.trigger {
padding: 0 24px;
font-size: 18px;
line-height: 64px;
cursor: pointer;
transition: color 0.3s;
}

.trigger:hover {
color: #1890ff;
}

.logo {
height: 32px;
margin: 16px;
background: rgba(255, 255, 255, 0.3);
}

.site-layout .site-layout-background {
background: #fff;
}
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import 'antd/dist/antd.css';
import App from './App';
import { store } from './app/store';
import { Provider } from 'react-redux';
Expand Down

0 comments on commit fc0e53c

Please sign in to comment.