Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
848a8d95
Commit
848a8d95
authored
Oct 11, 2017
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renew NoticeIcon
parent
a949a3c2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
54 deletions
+64
-54
src/components/NoticeIcon/NoticeList.js
src/components/NoticeIcon/NoticeList.js
+21
-15
src/components/NoticeIcon/NoticeList.less
src/components/NoticeIcon/NoticeList.less
+10
-25
src/components/NoticeIcon/demo/popover.md
src/components/NoticeIcon/demo/popover.md
+22
-3
src/components/NoticeIcon/index.js
src/components/NoticeIcon/index.js
+7
-2
src/components/NoticeIcon/index.less
src/components/NoticeIcon/index.less
+2
-8
src/components/NoticeIcon/index.md
src/components/NoticeIcon/index.md
+1
-0
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+1
-1
No files found.
src/components/NoticeIcon/NoticeList.js
View file @
848a8d95
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Avatar
,
Icon
}
from
'
antd
'
;
import
{
Avatar
,
Icon
,
List
}
from
'
antd
'
;
import
classNames
from
'
classnames
'
;
import
classNames
from
'
classnames
'
;
import
styles
from
'
./NoticeList.less
'
;
import
styles
from
'
./NoticeList.less
'
;
...
@@ -14,28 +14,34 @@ export default function NoticeList({ data = [], onClick, onClear, title, locale
...
@@ -14,28 +14,34 @@ export default function NoticeList({ data = [], onClick, onClear, title, locale
}
}
return
(
return
(
<
div
>
<
div
>
<
ul
className
=
{
styles
.
list
}
>
<
List
className
=
{
styles
.
list
}
>
{
data
.
map
((
item
,
i
)
=>
{
{
data
.
map
((
item
,
i
)
=>
{
const
itemCls
=
classNames
(
styles
.
item
,
{
const
itemCls
=
classNames
(
styles
.
item
,
{
[
styles
.
read
]:
item
.
read
,
[
styles
.
read
]:
item
.
read
,
});
});
return
(
return
(
<
li
className
=
{
itemCls
}
key
=
{
item
.
key
||
i
}
onClick
=
{()
=>
onClick
(
item
)}
>
<
List
.
Item
className
=
{
itemCls
}
key
=
{
item
.
key
||
i
}
onClick
=
{()
=>
onClick
(
item
)}
>
<
div
className
=
{
styles
.
wrapper
}
>
<
List
.
Item
.
Meta
{
item
.
avatar
?
<
Avatar
className
=
{
styles
.
avatar
}
src
=
{
item
.
avatar
}
/> : null
}
avatar
=
{
item
.
avatar
?
<
Avatar
className
=
{
styles
.
avatar
}
src
=
{
item
.
avatar
}
/> : null
}
<
div
className
=
{
styles
.
content
}
>
title
=
{
<
h4
className
=
{
styles
.
title
}
title
=
{
item
.
title
}
>
{
item
.
title
}
<
/h4
>
<
div
>
{
item
.
title
}
<
div
className
=
{
styles
.
extra
}
>
{
item
.
extra
}
<
/div
>
<
/div
>
}
description
=
{
<
div
>
<
div
className
=
{
styles
.
description
}
title
=
{
item
.
description
}
>
<
div
className
=
{
styles
.
description
}
title
=
{
item
.
description
}
>
{
item
.
description
}
{
item
.
description
}
<
/div
>
<
/div
>
<
div
className
=
{
styles
.
datetime
}
>
{
item
.
datetime
}
<
/div
>
<
div
className
=
{
styles
.
datetime
}
>
{
item
.
datetime
}
<
/div
>
<
div
className
=
{
styles
.
extra
}
>
{
item
.
extra
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
}
<
/li
>
/
>
<
/List.Item
>
);
);
})}
})}
<
/
ul
>
<
/
List
>
<
div
className
=
{
styles
.
clear
}
onClick
=
{
onClear
}
>
<
div
className
=
{
styles
.
clear
}
onClick
=
{
onClear
}
>
{
locale
.
clear
}{
title
}
{
locale
.
clear
}{
title
}
<
/div
>
<
/div
>
...
...
src/components/NoticeIcon/NoticeList.less
View file @
848a8d95
...
@@ -7,31 +7,18 @@
...
@@ -7,31 +7,18 @@
transition: all .3s;
transition: all .3s;
overflow: hidden;
overflow: hidden;
cursor: pointer;
cursor: pointer;
padding-left: 24px;
padding-right: 24px;
.wrapper {
margin: 0 32px;
padding: 12px 0;
border-bottom: 1px solid @border-color-split;
}
&.read {
&.read {
opacity: .4;
opacity: .4;
}
}
&:last-child
.wrapper
{
&:last-child {
border-bottom: 0;
border-bottom: 0;
}
}
&:hover {
&:hover {
background: @primary-1;
background: @primary-1;
}
}
.content {
position: relative;
overflow: hidden;
}
.avatar {
margin-right: 16px;
float: left;
margin-top: 4px;
background: #fff;
}
.title {
.title {
font-weight: normal;
font-weight: normal;
color: @text-color;
color: @text-color;
...
@@ -40,21 +27,19 @@
...
@@ -40,21 +27,19 @@
white-space: nowrap;
white-space: nowrap;
}
}
.description {
.description {
color: @text-color-secondary;
font-size: 12px;
font-size: 12px;
margin-top: 8px
;
line-height: @line-height-base
;
}
}
.datetime {
.datetime {
color: @text-color-secondary;
font-size: 12px;
font-size: 12px;
margin-top: 4px;
margin-top: 4px;
line-height: @line-height-base;
}
}
.extra {
.extra {
position: absolute;
float: right;
right: 0;
top: 0;
color: @text-color-secondary;
color: @text-color-secondary;
font-size: 12px;
font-weight: normal;
margin-right: 0;
}
}
}
}
}
}
...
@@ -77,13 +62,13 @@
...
@@ -77,13 +62,13 @@
height: 46px;
height: 46px;
line-height: 46px;
line-height: 46px;
text-align: center;
text-align: center;
color: @text-color
-secondary
;
color: @text-color;
border-radius: 0 0 @border-radius-base @border-radius-base;
border-radius: 0 0 @border-radius-base @border-radius-base;
border-top: 1px solid @border-color-split;
border-top: 1px solid @border-color-split;
transition: all .3s;
transition: all .3s;
cursor: pointer;
cursor: pointer;
&:hover {
&:hover {
color: @
text
-color;
color: @
heading
-color;
}
}
}
}
src/components/NoticeIcon/demo/popover.md
View file @
848a8d95
...
@@ -3,11 +3,12 @@ order: 2
...
@@ -3,11 +3,12 @@ order: 2
title
:
带浮层卡片
title
:
带浮层卡片
---
---
点击展开通知卡片,展现多种类型的通知。
点击展开通知卡片,展现多种类型的通知
,通常放在顶部通栏
。
````
jsx
````
jsx
import
NoticeIcon
from
'
ant-design-pro/lib/NoticeIcon
'
;
import
NoticeIcon
from
'
ant-design-pro/lib/NoticeIcon
'
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
import
{
Tag
}
from
'
antd
'
;
const
data
=
[{
const
data
=
[{
key
:
'
1
'
,
key
:
'
1
'
,
...
@@ -27,11 +28,29 @@ const data = [{
...
@@ -27,11 +28,29 @@ const data = [{
title
:
'
标题
'
,
title
:
'
标题
'
,
description
:
'
这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像
'
,
description
:
'
这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像
'
,
datetime
:
moment
(
'
2017-08-07
'
).
fromNow
(),
datetime
:
moment
(
'
2017-08-07
'
).
fromNow
(),
extra
:
<
Tag
color
=
"red"
>
标签
</
Tag
>,
}];
}];
function
onItemClick
(
item
,
tabProps
)
{
console
.
log
(
item
,
tabProps
);
}
function
onClear
(
tabTitle
)
{
console
.
log
(
tabTitle
);
}
ReactDOM
.
render
(
ReactDOM
.
render
(
<
div
style
=
{
{
width
:
300
,
textAlign
:
'
right
'
}
}
>
<
div
<
NoticeIcon
count
=
{
10
}
>
style
=
{
{
textAlign
:
'
right
'
,
height
:
'
64px
'
,
lineHeight
:
'
64px
'
,
boxShadow
:
'
0 1px 4px rgba(0,21,41,.12)
'
,
padding
:
'
0 32px
'
,
width
:
'
400px
'
,
}
}
>
<
NoticeIcon
count
=
{
5
}
onItemClick
=
{
onItemClick
}
onClear
=
{
onClear
}
>
<
NoticeIcon
.
Tab
list
=
{
data
}
title
=
"通知"
/>
<
NoticeIcon
.
Tab
list
=
{
data
}
title
=
"通知"
/>
<
NoticeIcon
.
Tab
list
=
{
data
}
title
=
"消息"
/>
<
NoticeIcon
.
Tab
list
=
{
data
}
title
=
"消息"
/>
<
NoticeIcon
.
Tab
list
=
{
[]
}
title
=
"待办"
/>
<
NoticeIcon
.
Tab
list
=
{
[]
}
title
=
"待办"
/>
...
...
src/components/NoticeIcon/index.js
View file @
848a8d95
...
@@ -63,7 +63,7 @@ export default class NoticeIcon extends PureComponent {
...
@@ -63,7 +63,7 @@ export default class NoticeIcon extends PureComponent {
);
);
}
}
render
()
{
render
()
{
const
{
className
,
count
,
popupAlign
}
=
this
.
props
;
const
{
className
,
count
,
popupAlign
,
onPopupVisibleChange
}
=
this
.
props
;
const
noticeButtonClass
=
classNames
(
className
,
styles
.
noticeButton
);
const
noticeButtonClass
=
classNames
(
className
,
styles
.
noticeButton
);
const
notificationBox
=
this
.
getNotificationBox
();
const
notificationBox
=
this
.
getNotificationBox
();
const
trigger
=
(
const
trigger
=
(
...
@@ -76,6 +76,10 @@ export default class NoticeIcon extends PureComponent {
...
@@ -76,6 +76,10 @@ export default class NoticeIcon extends PureComponent {
if
(
!
notificationBox
)
{
if
(
!
notificationBox
)
{
return
trigger
;
return
trigger
;
}
}
const
popoverProps
=
{};
if
(
'
popupVisible
'
in
this
.
props
)
{
popoverProps
.
visible
=
this
.
props
.
popupVisible
;
}
return
(
return
(
<
Popover
<
Popover
placement
=
"
bottomRight
"
placement
=
"
bottomRight
"
...
@@ -84,7 +88,8 @@ export default class NoticeIcon extends PureComponent {
...
@@ -84,7 +88,8 @@ export default class NoticeIcon extends PureComponent {
trigger
=
"
click
"
trigger
=
"
click
"
arrowPointAtCenter
arrowPointAtCenter
popupAlign
=
{
popupAlign
}
popupAlign
=
{
popupAlign
}
onVisibleChange
=
{
this
.
props
.
onPopupVisibleChange
}
onVisibleChange
=
{
onPopupVisibleChange
}
{...
popoverProps
}
>
>
{
trigger
}
{
trigger
}
<
/Popover
>
<
/Popover
>
...
...
src/components/NoticeIcon/index.less
View file @
848a8d95
...
@@ -14,23 +14,17 @@
...
@@ -14,23 +14,17 @@
}
}
.icon {
.icon {
font-size: 20px;
font-size: 16px;
padding: 4px;
}
}
.tabs {
.tabs {
:global {
:global {
.ant-tabs-nav-container {
font-size: 14px;
}
.ant-tabs-nav-scroll {
.ant-tabs-nav-scroll {
text-align: center;
text-align: center;
}
}
.ant-tabs-bar {
.ant-tabs-bar {
margin-bottom: 0;
margin-bottom: 0;
}
}
.ant-tabs-nav .ant-tabs-tab {
padding-top: 16px;
padding-bottom: 16px;
}
}
}
}
}
src/components/NoticeIcon/index.md
View file @
848a8d95
...
@@ -19,6 +19,7 @@ onItemClick | 点击列表项的回调 | function(item, tabProps) | -
...
@@ -19,6 +19,7 @@ onItemClick | 点击列表项的回调 | function(item, tabProps) | -
onTabChange | 切换页签的回调 | function(tabTitle) | -
onTabChange | 切换页签的回调 | function(tabTitle) | -
popupAlign | 弹出卡片的位置配置 | Object
[
alignConfig
](
https://github.com/yiminghe/dom-align#alignconfig-object-details
)
| -
popupAlign | 弹出卡片的位置配置 | Object
[
alignConfig
](
https://github.com/yiminghe/dom-align#alignconfig-object-details
)
| -
onPopupVisibleChange | 弹出卡片显隐的回调 | function(visible) | -
onPopupVisibleChange | 弹出卡片显隐的回调 | function(visible) | -
popupVisible | 控制弹层显隐 | boolean | -
locale | 默认文案 | Object |
`{ emptyText: '暂无数据', clear: '清空' }`
locale | 默认文案 | Object |
`{ emptyText: '暂无数据', clear: '清空' }`
### NoticeIcon.Tab
### NoticeIcon.Tab
...
...
src/layouts/BasicLayout.js
View file @
848a8d95
...
@@ -126,7 +126,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -126,7 +126,7 @@ class BasicLayout extends React.PureComponent {
urgent
:
'
red
'
,
urgent
:
'
red
'
,
doing
:
'
yellow
'
,
doing
:
'
yellow
'
,
})[
newNotice
.
status
];
})[
newNotice
.
status
];
newNotice
.
extra
=
<
Tag
color
=
{
`
${
color
}
-inverse`
}
>
{
newNotice
.
extra
}
<
/Tag>
;
newNotice
.
extra
=
<
Tag
color
=
{
color
}
>
{
newNotice
.
extra
}
<
/Tag>
;
}
}
return
newNotice
;
return
newNotice
;
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment