Skip to content

Commit

Permalink
feat: 加入modal组件
Browse files Browse the repository at this point in the history
  • Loading branch information
fikyair committed Oct 15, 2021
1 parent b60f858 commit 1fc3eae
Show file tree
Hide file tree
Showing 24 changed files with 960 additions and 88 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/DropdownButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { Dropdown, useDropdownToggle, useDropdownMenu } from "react-overlays";
import scopedClass from "../../utils/scopedClass";
import classNames from "classnames";
import { Button } from "../Buttons/button";
import { Button } from "../Button/button";

const sc = scopedClass("chocolate-dropdown");

Expand Down
2 changes: 1 addition & 1 deletion src/components/InputDatePicker/datePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getDate from "date-fns/getDate";
import getMonth from "date-fns/getMonth";
import isSameDay from "date-fns/isSameDay";
import dateFnsIsToday from "date-fns/isToday";
import { Button } from "../Buttons/button";
import { Button } from "../Button/button";
import { CalendarProps } from "./calendar";

const sc = scopedClass("chocolate-picker");
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputDatePicker/dateView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {
} from "react";
import { ViewLayout } from "./viewLayout";
import DatePicker, { CalendarType } from "./datePicker";
import { Button } from "../Buttons/button";
import { Button } from "../Button/button";
import Icon from "../Icon/icon";
import HeaderTitle from "./headerTitle";
import { CalendarProps } from "./calendar";
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputDatePicker/headerTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Button } from "../Buttons/button";
import { Button } from "../Button/button";
import format from "date-fns/format";
import { CalendarType } from "./datePicker";
import YearPicker from "./yearPicker";
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputDatePicker/monthPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import scopedClass from "../../utils/scopedClass";
import { Button } from "../Buttons/button";
import { Button } from "../Button/button";
import { buildMonths } from "./utils/generator";
import classNames from "classnames";
const sc = scopedClass("chocolate-picker-month");
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputDatePicker/monthYearView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ChangeEvent, MouseEventHandler } from "react";
import MonthPicker from "./monthPicker";
import ViewLayout from "./viewLayout";
import { Button } from "../Buttons/button";
import { Button } from "../Button/button";
import Icon from "../Icon";
import { CalendarType } from "./datePicker";
import HeaderTitle from "./headerTitle";
Expand Down
Binary file added src/components/Modal/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Modal from "./modal";

export default Modal;
63 changes: 63 additions & 0 deletions src/components/Modal/modal-doc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!-- Modal Doc -->
## Modal 模态框
对话框组件

import { Story, Meta, ArgsTable, Source } from '@storybook/addon-docs/blocks';
import { Modal } from './modal';
import dedent from 'ts-dedent';
<Meta title="Components/Input" component={Modal} />;

### 使用

<Source
language='jsx'
code={
dedent`
<Modal
title="提示"
visible={visible}
showMask
onCancel={() => setVisible(false)}
footer={
<>
<Button
btnType="default"
size="sm"
onClick={() => setVisible(false)}
>
取消
</Button>
<Button
btnType="primary"
style={{ marginLeft: 16 }}
onClick={() => setVisible(false)}
size="sm"
>
确认
</Button>
</>
}
>
<div>确认一下</div>
<span style={{ color: "#999999", fontSize: 12 }}>
是否要关闭模态框?
</span>
</Modal>
`
}
/>

### 具体参数
<ArgsTable of={Modal} />

export const Template = (args) => <Modal {...args} />


### 组件展示


##### default 类型

<Story name="default" id="modal--default">
{Template.bind({})}
</Story>
Loading

0 comments on commit 1fc3eae

Please sign in to comment.