Skip to content

Commit

Permalink
feat(flat-components): add remove history room modal to flat-componen…
Browse files Browse the repository at this point in the history
…ts (#724)
  • Loading branch information
Cheerego7 authored Jun 8, 2021
1 parent 400e874 commit 9dbdf9d
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import { Meta, Story } from "@storybook/react";
import { RemoveHistoryRoomModal, RemoveHistoryRoomModalProps } from ".";

const storyMeta: Meta = {
title: "Components/RemoveHistoryRoomModal",
component: RemoveHistoryRoomModal,
};

export default storyMeta;

export const Overview: Story<RemoveHistoryRoomModalProps> = args => (
<div className="vh-75 mw8-ns">
<RemoveHistoryRoomModal {...args} />
</div>
);
Overview.args = {
visible: true,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import "./style.less";

import React from "react";
import { observer } from "mobx-react-lite";
import { Button, Modal } from "antd";

export interface RemoveHistoryRoomModalProps {
visible: boolean;
onCancel: () => void;
onConfirm: () => void;
loading: boolean;
}

export const RemoveHistoryRoomModal = observer<RemoveHistoryRoomModalProps>(
function RemoveHistoryRoomModal({ visible, onCancel, onConfirm, loading }) {
return (
<Modal
wrapClassName="remove-history-room-modal-container"
title="删除房间记录"
visible={visible}
onCancel={onCancel}
footer={[
<Button key="exit-cancel" onClick={onCancel}>
取消
</Button>,
<Button key="exit-confirm" danger loading={loading} onClick={onConfirm}>
确定
</Button>,
]}
destroyOnClose
>
确定删除当前房间记录?
</Modal>
);
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.remove-history-room-modal-container {
> .ant-modal {
> .ant-modal-content {
> .ant-modal-header {
border-bottom: none;
}

> .ant-modal-footer {
border-top: none;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "./style.less";

import { Button, Checkbox, Modal } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -76,6 +78,7 @@ export const RemoveRoomModal: React.FC<RemoveRoomModalProps> = ({

return (
<Modal
wrapClassName="remove-room-modal-container"
visible={cancelModalVisible}
title={title}
onCancel={onCancel}
Expand Down
13 changes: 13 additions & 0 deletions packages/flat-components/src/components/RemoveRoomModal/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.remove-room-modal-container {
> .ant-modal {
> .ant-modal-content {
> .ant-modal-header {
border-bottom: none;
}

> .ant-modal-footer {
border-top: none;
}
}
}
}
1 change: 1 addition & 0 deletions packages/flat-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from "./components/LoginPage";
export * from "./components/MainPageLayout";
export * from "./components/MainPageLayoutHorizontal";
export * from "./components/PeriodicRoomPage";
export * from "./components/RemoveHistoryRoomModal";
export * from "./components/RemoveRoomModal";
export * from "./components/RoomDetailPage";
export * from "./components/RoomStatusElement";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { observer } from "mobx-react-lite";
import { isSameDay } from "date-fns";
import {
InviteModal,
RemoveHistoryRoomModal,
RemoveRoomModal,
RoomListAlreadyLoaded,
RoomListDate,
Expand All @@ -15,7 +16,6 @@ import {
} from "flat-components";
import { ListRoomsType } from "../../../apiMiddleware/flatServer";
import { RoomStatus, RoomType } from "../../../apiMiddleware/flatServer/constants";
// import { RemoveHistoryRoomModal } from "../../../components/Modal/RemoveHistoryRoomModal";
import { GlobalStoreContext, RoomStoreContext } from "../../../components/StoreProvider";
import { errorTips } from "../../../components/Tips/ErrorTips";
import { RoomItem } from "../../../stores/RoomStore";
Expand Down Expand Up @@ -191,14 +191,14 @@ export const MainRoomList = observer<MainRoomListProps>(function MainRoomList({
/>
)}
{/* TODO: add removeHistoryLoading to flat-component */}
{/* {currentRoom && (
{currentRoom && (
<RemoveHistoryRoomModal
visible={removeHistoryVisible}
onConfirm={removeConfirm}
onCancel={hideRemoveHistoryModal}
loading={removeHistoryLoading}
/>
)} */}
)}
</>
);

Expand Down

0 comments on commit 9dbdf9d

Please sign in to comment.