Skip to content

Commit

Permalink
chore:本地历史按钮占位
Browse files Browse the repository at this point in the history
  • Loading branch information
LinFeng1997 committed Nov 30, 2019
1 parent baeea41 commit 6726a60
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/component/Dialog/HistoryDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, {Component} from "react";
import {observer, inject} from "mobx-react";
import {Modal} from "antd";

@inject("dialog")
@observer
class HistoryDialog extends Component {
closeDialog = () => {
this.props.dialog.setHistoryOpen(false);
};

render() {
return (
<Modal
title="本地历史"
okText="确认"
cancelText="取消"
visible={this.props.dialog.isHistoryOpen}
onOk={this.closeDialog}
onCancel={this.closeDialog}
>
</Modal>
);
}
}

export default HistoryDialog;
9 changes: 9 additions & 0 deletions src/component/NavbarLeft/History.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.nice-btn-history {
padding: 0;
}

.nice-btn-history-icon {
padding: 6px 7px 10px 7px;
width: 33px;
height: 33px;
}
27 changes: 27 additions & 0 deletions src/component/NavbarLeft/History.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, {Component} from "react";
import {observer, inject} from "mobx-react";
import {Button, Tooltip} from "antd";

import {ENTER_DELAY, LEAVE_DELAY} from "../../utils/constant";
import SvgIcon from "../../icon";
import "./History.css";

@inject("dialog")
@observer
class History extends Component {
handleClick = () => {
this.props.dialog.setHistoryOpen(true);
};

render() {
return (
<Tooltip placement="bottom" mouseEnterDelay={ENTER_DELAY} mouseLeaveDelay={LEAVE_DELAY} title="本地历史">
<Button className="nice-btn-history" onClick={this.handleClick}>
<SvgIcon name="history" className="nice-btn-history-icon" />
</Button>
</Tooltip>
);
}
}

export default History;
20 changes: 20 additions & 0 deletions src/icon/History.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import "./index.css";

export default ({fill = "rgba(0,0,0,0.65)", style = {}, className = "icon", viewBox = "0 0 1024 1024"}) => (
<svg
t="1575107151909" className="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="1193" width="200" height="200"
style={style}
viewBox={viewBox}
className={className}
fill={fill}
>
<path
d="M511.998 64C264.574 64 64 264.574 64 511.998S264.574 960 511.998 960 960 759.422 960 511.998 759.422 64 511.998 64z m353.851 597.438c-82.215 194.648-306.657 285.794-501.306 203.579S78.749 558.36 160.964 363.711 467.621 77.917 662.27 160.132c168.009 70.963 262.57 250.652 225.926 429.313a383.995 383.995 0 0 1-22.347 71.993z"
fill="#666666" p-id="1194"></path>
<path
d="M543.311 498.639V256.121c0-17.657-14.314-31.97-31.97-31.97s-31.97 14.314-31.97 31.97v269.005l201.481 201.481c12.485 12.485 32.728 12.485 45.213 0s12.485-32.728 0-45.213L543.311 498.639z"
fill="#666666" p-id="1195"></path>
</svg>
);
3 changes: 3 additions & 0 deletions src/icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Setting from "./Setting";
import Smile from "./Smile";
import Mobile from "./Mobile";
import PC from "./PC";
import History from "./History";

export default (props) => {
switch (props.name) {
Expand Down Expand Up @@ -69,6 +70,8 @@ export default (props) => {
return <Mobile {...props} />;
case "form":
return <Form {...props} />;
case "history":
return <History {...props} />;
default:
return <svg />;
}
Expand Down
2 changes: 2 additions & 0 deletions src/layout/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import AboutDialog from "../component/Dialog/AboutDialog";
import VersionDialog from "../component/Dialog/VersionDialog";
import FormDialog from "../component/Dialog/FormDialog";
import SettingDialog from "../component/Dialog/SettingDialog";
import HistoryDialog from "../component/Dialog/HistoryDialog";

class Dialog extends Component {
render() {
Expand All @@ -16,6 +17,7 @@ class Dialog extends Component {
<VersionDialog />
<FormDialog />
<SettingDialog />
<HistoryDialog />
</div>
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/layout/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Setting from "../component/NavbarLeft/Setting";
// import LogIn from "../component/LogIn";
// import User from "../component/User";
import About from "../component/NavbarLeft/About";
import History from "../component/NavbarLeft/History";
import Font from "../component/NavbarLeft/Font";

import "./Navbar.css";
Expand Down Expand Up @@ -61,6 +62,9 @@ class Navbar extends Component {
<Reset />
<About />
</ButtonGroup>
<ButtonGroup className="nice-btn-group-margin">
<History />
</ButtonGroup>
</div>
</div>
<div className="nice-right-nav">
Expand Down
7 changes: 7 additions & 0 deletions src/store/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Dialog {

@observable isSettingOpen = false;

@observable isHistoryOpen = false;

@action
setImageOpen = (isImageOpen) => {
this.isImageOpen = isImageOpen;
Expand Down Expand Up @@ -43,6 +45,11 @@ class Dialog {
setSettingOpen = (isSettingOpen) => {
this.isSettingOpen = isSettingOpen;
};

@action
setHistoryOpen = (isHistoryOpen) => {
this.isHistoryOpen = isHistoryOpen;
};
}

const store = new Dialog();
Expand Down

0 comments on commit 6726a60

Please sign in to comment.