Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flat-components): add remove history room modal to flat-components #724

Merged
merged 1 commit into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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