Skip to content

Commit

Permalink
fix: doc demo
Browse files Browse the repository at this point in the history
  • Loading branch information
kokiy committed Jan 28, 2021
1 parent fbceb24 commit bb57f62
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .umirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default defineConfig({
logo:
'https://user-images.githubusercontent.com/9554297/83762004-a0761b00-a6a9-11ea-83b4-9c8ff721d4b8.png',
outputPath: 'docs-dist',
publicPath: '/react-h5-calendar/',
base: '/react-h5-calendar/',
hash: true,
// more config: https://d.umijs.org/config
})
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

![demo](./qrcode.png)

### 直接打开浏览器查看 https://kokiy.github.io/react-h5-calendar/
### 直接打开浏览器查看 https://kokiy.github.io/react-h5-calendar/calendar

### react 移动端日历组件

Expand All @@ -25,7 +25,8 @@
3. 支持左右滑动切换月份
4. 支持上下滑动切换日历视图
5. 支持日历上打点标记
6. 基于[dayjs](https://github.com/iamkun/dayjs)处理日历逻辑
6. 本项目基于[dumi](https://github.com/umijs/dumi) 构建和发布
7. 基于[dayjs](https://github.com/iamkun/dayjs)处理日历逻辑

### 使用教程

Expand Down
73 changes: 73 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# react-h5-calendar

[简体中文](https://github.com/kokiy/react-h5-calendar/blob/main/README.md) | English

###

Build a small wheel, the core file is less than 300 lines, a react-based mobile , h5 calendar display component

### demo

![demo](./demo.gif)

### Scan the QR code to view the demo directly

![demo](./qrcode.png)

### Open the browser directly to view https://kokiy.github.io/react-h5-calendar/

### react Mobile calendar component

1. Support week view, week calendar
2. Support month view, month calendar
3. Support sliding left and right to switch months
4. Support sliding up and down to switch calendar view
5. Support dot mark on the calendar
6. This project is based on[dumi](https://github.com/umijs/dumi) build & deploy
7. based on[dayjs](https://github.com/iamkun/dayjs)Processing calendar logic

### Install

`yarn add react-h5-calendar`

```js
import { MobileCalendar } from 'react-h5-calendar'
export default class Demo extends Component {
render() {
return (
<MobileCalendar
onDateClick={date => this.setState({ currentDate: date.format('YYYY-MM-DD') })}
currentDate={'2020-12-12'}
/>
)
}
}
```

### Settings

| parameter | description | default |
| :------------------- | :------------------------------------------- | :--------- |
| `currentDate` | Currently selected date eg:`2020-12-12` | 'today' |
| `showType` | display type`month` & `week` | `month` |
| `transitionDuration` | Animation transition time for switching date | `0.3` |
| `onDateClick` | Date click callback | `() => {}` |
| `onTouchStart` | Swipe to start callback | `() => {}` |
| `onTouchMove` | Callback during sliding | `() => {}` |
| `onTouchEnd` | Sliding end callback | `() => {}` |
| `markType` | Mark type `dot`&`circle` | `dot` |
| `markDates` | Array of dates to be marked | `[]` |

### `markDates` Parameter Description

```js
const markDates = [
{ color: '#459', date: '2020-12-12', markType: 'circle' },
{ color: '#a8f', markType: 'dot', date: '2020-12-23' },
{ color: '#a5f', markType: 'circle', date: '2020-12-22' },
{ date: '2021-1-22' },
]
```

1. If the date is not passed `markType`, the passed `Marktype` will be taken by default
2. Single date does not pass `color` The default is `#f00`

0 comments on commit bb57f62

Please sign in to comment.