feat: init responsive mode
This commit is contained in:
parent
7852e12d42
commit
c452e8ed77
|
@ -6,8 +6,8 @@ export const BreadcumbComponent = (props) => {
|
|||
return (
|
||||
<div>
|
||||
<Breadcrumb style={{marginBottom: 10}}>
|
||||
{props.data.map((e) => (
|
||||
<Breadcrumb.Item>
|
||||
{props.data.map((e, index) => (
|
||||
<Breadcrumb.Item key={index}>
|
||||
<Link to={e.route}>
|
||||
<span>{e.name}</span>
|
||||
</Link>
|
||||
|
|
|
@ -46,3 +46,10 @@ code {
|
|||
background: #2D9CDB !important;
|
||||
}
|
||||
|
||||
.transparent {
|
||||
background: transparent
|
||||
}
|
||||
|
||||
.ppob-container {
|
||||
padding: 14px 14px 14px 14px;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import {PageHeader} from "antd";
|
||||
|
||||
export const About = () => {
|
||||
return <div>
|
||||
return <div className={["ppob-container"].join(" ")}>
|
||||
<PageHeader
|
||||
style={{
|
||||
padding: 0,
|
||||
|
|
|
@ -2,6 +2,7 @@ import React, {useEffect} from "react";
|
|||
import {DesktopLayout} from "./DesktopLayout";
|
||||
import {useMediaQuery} from 'react-responsive';
|
||||
import {useStore} from "../../utils/useStore";
|
||||
import {useHistory} from "react-router-dom";
|
||||
|
||||
|
||||
export const App = () => {
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
import React, {useState} from "react";
|
||||
import {Button, Layout, Menu, Popover, Typography,} from "antd";
|
||||
import {Button, Drawer, Layout, Menu, Popover, Typography,} from "antd";
|
||||
import {MenuList} from "./MenuList";
|
||||
import {Link} from "react-router-dom";
|
||||
import {PlusSquareOutlined, UserOutlined,} from "@ant-design/icons";
|
||||
import {CalendarOutlined, HomeOutlined, MenuOutlined, UserOutlined,} from "@ant-design/icons";
|
||||
import {AppRoute} from "../../routes/app";
|
||||
import {useStore} from "../../utils/useStore";
|
||||
import {observer} from "mobx-react-lite";
|
||||
|
||||
const {Text, Paragraph} = Typography;
|
||||
const {Header, Content, Sider} = Layout;
|
||||
|
||||
export const DesktopLayout = () => {
|
||||
export const DesktopLayout = observer(() => {
|
||||
const store = useStore();
|
||||
const [clicked, setClicked] = useState(false);
|
||||
|
||||
return (
|
||||
|
@ -23,7 +26,7 @@ export const DesktopLayout = () => {
|
|||
height: "100vh",
|
||||
}}
|
||||
>
|
||||
<Sider
|
||||
{store.ui.mediaQuery.isDesktop && <Sider
|
||||
className={"transparent"}
|
||||
width={240}
|
||||
style={{
|
||||
|
@ -70,82 +73,369 @@ export const DesktopLayout = () => {
|
|||
</div>
|
||||
<MenuList closeLeftDrawer={() => {
|
||||
}}/>
|
||||
</Sider>
|
||||
</Sider>}
|
||||
|
||||
{store.ui.mediaQuery.isMobile && (
|
||||
<Drawer
|
||||
title="Navigation"
|
||||
placement={"left"}
|
||||
closable={false}
|
||||
width={"50%"}
|
||||
onClose={() => {
|
||||
store.ui.toggleLeftDrawerIsShown()
|
||||
console.log("clicked");
|
||||
}}
|
||||
visible={store.ui.leftDrawerIsShown}
|
||||
key={"dashboard-drawer"}
|
||||
bodyStyle={{
|
||||
padding: 0,
|
||||
paddingTop: 20,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
marginLeft: 0,
|
||||
paddingLeft: 0,
|
||||
}}
|
||||
>
|
||||
<Menu>
|
||||
<Menu.Item key="home">
|
||||
<Link to={'/app/home'}>
|
||||
<HomeOutlined/>
|
||||
<span>Home</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="membership">
|
||||
<Link to={'/app/membership'}>
|
||||
<HomeOutlined/>
|
||||
<span>Membership</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="product">
|
||||
<Link to={'/app/product'}>
|
||||
<HomeOutlined/>
|
||||
<span>Product</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="transaction">
|
||||
<Link to={'/app/transaction'}>
|
||||
<HomeOutlined/>
|
||||
<span>Transaction</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="about">
|
||||
<Link to={'/app/about'}>
|
||||
<CalendarOutlined/>
|
||||
<span>About</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Divider style={{background: "transparent", paddingTop: 15}}/>
|
||||
</Menu>
|
||||
</div>
|
||||
</Drawer>
|
||||
)}
|
||||
|
||||
<Layout
|
||||
className={"transparent"}
|
||||
style={{
|
||||
paddingLeft: 240,
|
||||
position: "relative",
|
||||
display: "block",
|
||||
paddingLeft: store.ui.mediaQuery.isDesktop ? 200 : 0,
|
||||
height: "100vh",
|
||||
}}
|
||||
>
|
||||
<Header
|
||||
theme={"light"}
|
||||
className={store.ui.mediaQuery.isMobile ? "shadow" : null}
|
||||
style={{
|
||||
height: 54,
|
||||
paddingLeft: 0,
|
||||
paddingRight: 0,
|
||||
backgroundColor: "transparent",
|
||||
maxWidth: 1000,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-end",
|
||||
height: store.ui.mediaQuery.isDesktop ? 54 : 35,
|
||||
// width: 'calc(100vw - 200px)',
|
||||
width: "100%",
|
||||
position: store.ui.mediaQuery.isDesktop ? "fixed" : "fixed",
|
||||
zIndex: 99,
|
||||
paddingLeft: store.ui.mediaQuery.isDesktop ? 14 : 0,
|
||||
paddingRight: store.ui.mediaQuery.isDesktop ? 14 : 0,
|
||||
backgroundColor: store.ui.mediaQuery.isMobile
|
||||
? "#fff"
|
||||
: "transparent",
|
||||
maxWidth: store.ui.mediaQuery.isDesktop ? 1920 : 768,
|
||||
// minWidth: store.ui.mediaQuery.isDesktop ? 768 : 0,
|
||||
top: store.ui.mediaQuery.isMobile ? 0 : 12,
|
||||
/**/
|
||||
}}
|
||||
>
|
||||
<Button style={{right: "94%"}}>
|
||||
<PlusSquareOutlined/>
|
||||
</Button>
|
||||
<Popover
|
||||
autoAdjustOverflow={true}
|
||||
placement="bottomRight"
|
||||
content={
|
||||
<Menu
|
||||
type={"line"}
|
||||
inlineIndent={0}
|
||||
theme="light"
|
||||
{store.ui.mediaQuery.isMobile && (
|
||||
<div
|
||||
className={store.ui.mediaQuery.isMobile ? "shadow" : null}
|
||||
style={{
|
||||
top: 0,
|
||||
left: 0,
|
||||
paddingTop: 8,
|
||||
position: "relative",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "stretch",
|
||||
flexDirection: "column",
|
||||
// boxShadow: '0 7px 14px 0 rgba(60, 66, 87, 0.05), 0 3px 6px 0 rgba(0, 0, 0, 0.05)'
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: "transparent",
|
||||
borderRightWidth: 0,
|
||||
right: "30%",
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
paddingLeft: store.ui.mediaQuery.isMobile ? 10 : 20,
|
||||
paddingRight: store.ui.mediaQuery.isMobile ? 0 : 20,
|
||||
paddingBottom: 4,
|
||||
marginTop: -5,
|
||||
}}
|
||||
mode="inline"
|
||||
>
|
||||
<Menu.Item>
|
||||
<Link to="/app/profile">
|
||||
<span>Profile</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
<Button
|
||||
type="link"
|
||||
icon={
|
||||
<MenuOutlined
|
||||
style={{
|
||||
fontSize: "12px",
|
||||
color: "#5b5b5b",
|
||||
marginLeft: -10,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
onClick={() => {
|
||||
// store.authentication.logout();
|
||||
// return history.push("/login");
|
||||
store.ui.toggleLeftDrawerIsShown();
|
||||
console.log("apa")
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "stretch",
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
paddingTop: 5,
|
||||
}}
|
||||
>
|
||||
<span>Sign out</span>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
}
|
||||
title={
|
||||
<Text>
|
||||
info@bangun-kreatif.com
|
||||
{/*{store.userData.email}{" "}*/}
|
||||
<Paragraph style={{fontWeight: 400}} type={"secondary-dark"}>
|
||||
Administrator
|
||||
{/*{store.userData.role}*/}
|
||||
</Paragraph>
|
||||
</Text>
|
||||
}
|
||||
trigger="click"
|
||||
visible={clicked}
|
||||
onVisibleChange={() => setClicked(!clicked)}
|
||||
>
|
||||
<Button
|
||||
size={"default"}
|
||||
style={{}}
|
||||
icon={<UserOutlined style={{fontSize: "13px"}}/>}
|
||||
/>
|
||||
</Popover>
|
||||
{/*<img*/}
|
||||
{/* className={[classes.logoFull]}*/}
|
||||
{/* style={{*/}
|
||||
{/* maxHeight: 18,*/}
|
||||
{/* maxWidth: 75,*/}
|
||||
{/* }}*/}
|
||||
{/* src={parkirLogoFull}*/}
|
||||
{/*/>*/}
|
||||
{/*<Paragraph*/}
|
||||
{/* style={{*/}
|
||||
{/* margin: "-5px 0px 0px 2px",*/}
|
||||
{/* padding: 0,*/}
|
||||
{/* lineHeight: "18px",*/}
|
||||
{/* fontSize: 8,*/}
|
||||
{/* fontWeight: 800,*/}
|
||||
{/* color: "#8c8c8c",*/}
|
||||
{/* textAlign: "center",*/}
|
||||
{/* }}*/}
|
||||
{/*>*/}
|
||||
{/* {store.authentication.userData.role || "Apps"}*/}
|
||||
{/*</Paragraph>*/}
|
||||
</div>
|
||||
<Popover
|
||||
className={store.ui.mediaQuery.isDesktop ? "shadow" : null}
|
||||
autoAdjustOverflow={true}
|
||||
placement="bottomRight"
|
||||
content={
|
||||
<Menu
|
||||
type={"line"}
|
||||
inlineIndent={0}
|
||||
theme="light"
|
||||
style={{
|
||||
backgroundColor: "transparent",
|
||||
borderRightWidth: 0,
|
||||
}}
|
||||
mode="inline"
|
||||
>
|
||||
<Menu.Item>
|
||||
<Link to="/app/profile">
|
||||
<span>Profile</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
onClick={() => {
|
||||
// store.authentication.logout();
|
||||
// return history.push("/login");
|
||||
}}
|
||||
>
|
||||
<span>Sign out</span>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
}
|
||||
title={
|
||||
<Text>
|
||||
{/*{store.user.data.email}{" "}*/}
|
||||
{/*<Paragraph style={{fontWeight: 400}} type={"secondary-dark"}>*/}
|
||||
{/* {store.authentication.userData.full_name}*/}
|
||||
{/*</Paragraph>*/}
|
||||
</Text>
|
||||
}
|
||||
trigger="click"
|
||||
visible={clicked}
|
||||
onVisibleChange={() => setClicked(!clicked)}
|
||||
>
|
||||
<Button
|
||||
size={"default"}
|
||||
type={store.ui.mediaQuery.isDesktop ? "" : "link"}
|
||||
style={{marginRight: store.ui.mediaQuery.isDesktop ? 20 : 10}}
|
||||
icon={
|
||||
store.ui.mediaQuery.isDesktop ? (
|
||||
<UserOutlined style={{fontSize: "13px"}}/>
|
||||
) : (
|
||||
<UserOutlined style={{fontSize: "13px", color: "#5b5b5b"}}/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Popover>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
borderTopWidth: 0.5,
|
||||
borderTopColor: "#e3e3e3",
|
||||
borderTopStyle: "solid",
|
||||
}}
|
||||
/>
|
||||
{/*<BreadcumbComponent data={}/>*/}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{store.ui.mediaQuery.isDesktop && (
|
||||
<div
|
||||
className={["transparent"].join(" ")}
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
height: "100%",
|
||||
maxWidth: 1024,
|
||||
minWidth: 768,
|
||||
width: "calc(100vw - 220px)",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
display: "flex",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
</div>
|
||||
<Popover
|
||||
className={store.ui.mediaQuery.isDesktop ? "shadow" : null}
|
||||
autoAdjustOverflow={true}
|
||||
placement="bottomRight"
|
||||
content={
|
||||
<Menu
|
||||
type={"line"}
|
||||
inlineIndent={0}
|
||||
theme="light"
|
||||
style={{
|
||||
backgroundColor: "transparent",
|
||||
borderRightWidth: 0,
|
||||
}}
|
||||
mode="inline"
|
||||
>
|
||||
<Menu.Item>
|
||||
<Link to="/app/profile">
|
||||
<span>Profile</span>
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
onClick={() => {
|
||||
// store.authentication.logout();
|
||||
// return history.push("/login");
|
||||
}}
|
||||
>
|
||||
<span>Sign out</span>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
}
|
||||
title={
|
||||
<Text>
|
||||
{store.user.data.email}{" "}
|
||||
<Paragraph style={{fontWeight: 400}} type={"secondary-dark"}>
|
||||
{/*{store.authentication.userData.full_name}*/}
|
||||
</Paragraph>
|
||||
</Text>
|
||||
}
|
||||
trigger="click"
|
||||
visible={clicked}
|
||||
onVisibleChange={() => setClicked(!clicked)}
|
||||
>
|
||||
<Button
|
||||
size={"default"}
|
||||
type={store.ui.mediaQuery.isDesktop ? "" : "link"}
|
||||
style={{marginRight: store.ui.mediaQuery.isDesktop ? 20 : 10}}
|
||||
icon={
|
||||
store.ui.mediaQuery.isDesktop ? (
|
||||
<UserOutlined style={{fontSize: "13px"}}/>
|
||||
) : (
|
||||
<UserOutlined style={{fontSize: "13px", color: "#5b5b5b"}}/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
</div>
|
||||
)}
|
||||
</Header>
|
||||
<AppRoute/>
|
||||
|
||||
<Layout
|
||||
className={["transparent"].join(" ")}
|
||||
tabIndex={"-1"}
|
||||
style={{
|
||||
zIndex: 0,
|
||||
display: "flex",
|
||||
// overflowX: store.ui.mediaQuery.isMobile ? 'auto' : "hidden",
|
||||
// paddingLeft: 8,
|
||||
// paddingRight: 8,
|
||||
// width: 'calc(90vw - 220px)',
|
||||
height: "100%",
|
||||
}}
|
||||
>
|
||||
<Content
|
||||
className={["transparent"].join(" ")}
|
||||
style={{
|
||||
// maxHeight: 'calc(100vh - 98px)',
|
||||
// paddingBottom: 48,
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
position: "relative",
|
||||
marginTop: store.ui.mediaQuery.isDesktop ? 43 : 37,
|
||||
// overflow: 'auto',
|
||||
overflowX: store.ui.mediaQuery.isMobile ? "auto" : "hidden",
|
||||
// minWidth: 768,
|
||||
maxWidth: 1024,
|
||||
// minWidth: 768,
|
||||
width: store.ui.mediaQuery.isDesktop
|
||||
? "calc(100vw - 210px)"
|
||||
: "calc(100vw)",
|
||||
zIndex: 22,
|
||||
// height: `calc(100vh - ${store.ui.mediaQuery.isDesktop ? 78 : 71}px)`,
|
||||
height: `calc(100vh - ${
|
||||
store.ui.mediaQuery.isDesktop ? 78 : 71
|
||||
}px)`,
|
||||
// paddingLeft: 8,
|
||||
// paddingRight: 8
|
||||
}}
|
||||
>
|
||||
<AppRoute/>
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Layout>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ import {store} from "../../utils/useStore";
|
|||
import {observer} from "mobx-react-lite";
|
||||
|
||||
export const Home = observer(() => {
|
||||
return <div>
|
||||
return <div className={["ppob-container"].join(" ")}>
|
||||
<PageHeader
|
||||
style={{
|
||||
padding: 0,
|
||||
|
|
|
@ -134,7 +134,7 @@ export const Membership = observer(() => {
|
|||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={["ppob-container"].join(" ")}>
|
||||
<BreadcumbComponent data={routeData}/>
|
||||
<Card>
|
||||
{store.ui.mediaQuery.isDesktop && (
|
||||
|
@ -201,7 +201,6 @@ export const Membership = observer(() => {
|
|||
dataSource={store.membership.data}
|
||||
style={{padding: 0}}
|
||||
renderItem={(item) => {
|
||||
console.log(item, "item ->");
|
||||
return (
|
||||
<div>
|
||||
<List.Item
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import {makeAutoObservable} from "mobx";
|
||||
|
||||
export class UI {
|
||||
mediaQuery = {
|
||||
isMobile: false,
|
||||
isDesktop: true
|
||||
};
|
||||
|
||||
mediaQuery = {};
|
||||
testValue = "Test Mobx";
|
||||
leftDrawerIsShown = false;
|
||||
params = {};
|
||||
baseUrl = '/app';
|
||||
|
||||
constructor(ctx) {
|
||||
this.ctx = ctx;
|
||||
|
@ -22,4 +21,13 @@ export class UI {
|
|||
this.mediaQuery = data;
|
||||
}
|
||||
};
|
||||
|
||||
toggleLeftDrawerIsShown() {
|
||||
console.log('what')
|
||||
this.leftDrawerIsShown = !this.leftDrawerIsShown;
|
||||
}
|
||||
|
||||
setParams(data) {
|
||||
this.params = data;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user