Skip to content

Commit 60d0713

Browse files
committed
feat: 添加公告
1 parent 43f9163 commit 60d0713

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 声明
2+
3+
本项目已不再维护,项目已经升级到 ssr 版本,沿用并改进了 UI。新项目地址 [remix-ssr-blog](https://github.com/alvin0216/remix-ssr-blog)。欢迎继续关注!
4+
15
## react hooks + koa + mysql
26

37
> 一个及其简洁的个人博客系统、即插即用,如果你想使用这个博客、动动手改改配置即可使用!!

src/components/Public/index.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ import { getTagList, getCategoryList } from '@/redux/article/actions'
1010
// components
1111
import SignModal from '@/components/Public/SignModal'
1212
import UploadModal from '@/components/Public/UploadModal'
13+
import { Modal } from 'antd'
14+
import useModal from 'hooks/useModal'
1315

1416
/**
1517
* @component Public 公共组件,挂在在 APP.jsx 中,用于存放初始化的组件/方法 或者公用的 modal 等
1618
*/
1719
function PublicComponent(props) {
1820
const dispatch = useDispatch() // dispatch hooks
21+
const { modalProps } = useModal()
1922

2023
useMount(() => {
2124
dispatch(getTagList())
@@ -26,6 +29,13 @@ function PublicComponent(props) {
2629
<>
2730
<SignModal />
2831
<UploadModal />
32+
<Modal {...modalProps} title='公告'>
33+
<h4>本博客已不再维护!,该项目已升级为 ssr 版本,项目地址为{' '}
34+
<a href='https://github.com/alvin0216/remix-ssr-blog/' target='_blank'>remix-ssr-blogs</a>
35+
访问地址 <a href='https://remix.alvin.run/' target='_blank'>remix.alvin.run</a>
36+
多谢关注与支持!
37+
</h4>
38+
</Modal>
2939
</>
3040
)
3141
}

src/hooks/useModal.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { useCallback, useState } from 'react'
2+
3+
export default function useModal() {
4+
const [visible, setVisible] = useState(true)
5+
const show = useCallback(() => setVisible(true), [visible])
6+
const close = useCallback(() => setVisible(false), [visible])
7+
8+
const modalProps = {
9+
visible,
10+
onCancel: close
11+
}
12+
13+
return {
14+
visible,
15+
show,
16+
close,
17+
modalProps
18+
}
19+
}

0 commit comments

Comments
 (0)