Skip to content

Commit c4c05bd

Browse files
authored
Merge pull request #131 from nih-sparc/update-pagination
Added button pagination and announcement notification
2 parents 18436d8 + b199806 commit c4c05bd

File tree

8 files changed

+153
-13
lines changed

8 files changed

+153
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nih-sparc/sparc-design-system-components",
3-
"version": "0.26.29",
3+
"version": "0.26.30",
44
"private": false,
55
"scripts": {
66
"serve": "vue-cli-service serve",
Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
@import '../_variables.scss';
22

33
.el-message {
4-
padding: 15px 3px 15px 15px;
4+
padding: 1rem;
55
@media screen and (max-width: 767px) {
66
min-width: 250px;
77
}
8-
.el-message__closeBtn {
9-
color: #9CA1A3;
10-
transform: scale(0.8);
11-
top: 35%;
12-
}
138
&.el-message--success {
149
background-color: #F7FFEE;
1510
border: 1px solid #5E9F69;
1611
.el-icon-circle-check {
1712
color: #5E9F69;
1813
-webkit-text-stroke-width: 0.016rem;
19-
padding-right: 15px;
14+
padding-right: 1rem;
2015
}
2116
.el-message__content {
2217
color: #303133;
@@ -28,10 +23,31 @@
2823
.el-icon-circle-close {
2924
color: #B51D09;
3025
-webkit-text-stroke-width: 0.016rem;
31-
padding-right: 15px;
26+
padding-right: 1rem;
27+
}
28+
.el-message__content {
29+
color: #303133;
3230
}
31+
}
32+
&.el-message--info {
33+
background-color: #f9f2fc;;
34+
border: 1px solid $purple;
3335
.el-message__content {
3436
color: #303133;
37+
margin: 0 .5rem;
38+
}
39+
.about-icon {
40+
background-color: $purple;
41+
width: 1.5rem;
42+
height: 1.5rem;
43+
display: inline-block;
44+
content: '';
45+
-webkit-mask: url("data:image/svg+xml,%3Csvg id='icons' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3EDataPortal-Icons%3C/title%3E%3Cpath d='M12,5a7,7,0,1,1-7,7,7.008,7.008,0,0,1,7-7m0-2a9,9,0,1,0,9,9,9,9,0,0,0-9-9Z'/%3E%3Cpath d='M12,7.148a.9.9,0,1,0,.9.9.9.9,0,0,0-.9-.9Z'/%3E%3Cpath d='M12,17.148a1,1,0,0,1-1-1v-5.4a1,1,0,1,1,2,0v5.4A1,1,0,0,1,12,17.148Z'/%3E%3C/svg%3E");
46+
mask: url("data:image/svg+xml,%3Csvg id='icons' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3EDataPortal-Icons%3C/title%3E%3Cpath d='M12,5a7,7,0,1,1-7,7,7.008,7.008,0,0,1,7-7m0-2a9,9,0,1,0,9,9,9,9,0,0,0-9-9Z'/%3E%3Cpath d='M12,7.148a.9.9,0,1,0,.9.9.9.9,0,0,0-.9-.9Z'/%3E%3Cpath d='M12,17.148a1,1,0,0,1-1-1v-5.4a1,1,0,1,1,2,0v5.4A1,1,0,0,1,12,17.148Z'/%3E%3C/svg%3E");
47+
-webkit-mask-size: contain;
48+
mask-size: contain;
49+
mask-repeat: no-repeat;
50+
-webkit-mask-repeat: no-repeat;
3551
}
3652
}
3753
}

src/components/Pagination/src/Pagination.vue

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
<el-pagination
44
:page-size="pageSize"
55
:page-count="pageCount"
6-
:pager-count="5"
6+
:pager-count="pagerCount"
77
layout="prev, pager, next"
88
:total="totalCount"
99
:current-page="selected"
10+
:background="background"
1011
@current-change="selectPage"
1112
/>
1213
</div>
@@ -27,6 +28,14 @@ export default {
2728
totalCount: {
2829
type: Number,
2930
default: 0
31+
},
32+
background: {
33+
type: Boolean,
34+
default: false
35+
},
36+
pagerCount: {
37+
type: Number,
38+
default: 5
3039
}
3140
},
3241
computed: {
@@ -51,6 +60,39 @@ export default {
5160
padding-top: 1em;
5261
text-align: center;
5362
63+
.is-background {
64+
li.more,
65+
li.number {
66+
background: #f9f2fc;
67+
border: 1.5px solid $app-primary-color;
68+
color: $app-primary-color;
69+
border-radius: 50%;
70+
}
71+
.el-pager .more::before {
72+
line-height: 0;
73+
}
74+
li.number.active {
75+
color: white;
76+
}
77+
.btn-next, .btn-prev {
78+
background: $app-primary-color;
79+
color: white;
80+
border-radius: 50%;
81+
}
82+
.btn-next:disabled, .btn-prev:disabled {
83+
background: $lightGrey;
84+
opacity: 0.3;
85+
color: white;
86+
}
87+
.btn-next .el-icon, .btn-prev .el-icon {
88+
font-size: 1rem;
89+
}
90+
li.number:hover {
91+
background: $app-primary-color;
92+
color: white !important;
93+
}
94+
}
95+
5496
button.btn-prev {
5597
background: transparent;
5698
}

src/stories/Pagination/pagination.stories.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ export default {
66
includeStories: []
77
}
88

9-
const createDemo = (selected, totalCount, pageSize) => {
9+
const createDemo = (selected, totalCount, pageSize, background=false) => {
1010
return {
1111
components: { Pagination },
1212
data() {
1313
return {
1414
selected: selected,
1515
totalCount: totalCount,
16-
pageSize: pageSize
16+
pageSize: pageSize,
17+
background: background
1718
}
1819
},
1920
template: `
2021
<div>
21-
<pagination :total-count="totalCount" :selected="selected" :page-size="pageSize" />
22+
<pagination :total-count="totalCount" :selected="selected" :page-size="pageSize" :background="background"/>
2223
</div>
2324
`
2425
}
@@ -28,6 +29,8 @@ export const Primary = () => createDemo(3, 100, 20)
2829

2930
export const Secondary = () => createDemo(10, 1000, 20)
3031

32+
export const Background = () => createDemo(10, 1000, 20, true)
33+
3134
export const Menu = () => ({
3235
components: { PaginationMenu },
3336
data() {

src/stories/Pagination/pagination.stories.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ The pagination component combines pager and page navigation elements to allow th
2525
### Collapsed Pager
2626
<Story name='Collapsed Pager'>{stories.Secondary()}</Story>
2727

28+
### Button Pager
29+
<Story name='Button Pager'>{stories.Background()}</Story>
30+
2831
# Pagination menu
2932

3033
The Pagination component can be paired with the PaginationMenu component to provide the user a way to change the `pageSize`. The two components can be connected using the two events they emit in tandem.

src/stories/notification/notification.stories.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,29 @@ export const FailureNotification = () => ({
106106
</el-button>
107107
`
108108
})
109+
110+
export const InfoNotification = () => ({
111+
data() {
112+
return {
113+
notification : {
114+
message: 'Portal Announcement Notification.',
115+
showClose: true,
116+
iconClass: 'about-icon',
117+
customClass: 'el-message--info',
118+
duration: 5000
119+
}
120+
}
121+
},
122+
methods: {
123+
clickHandler() {
124+
this.$message(this.notification)
125+
}
126+
},
127+
template: `
128+
<el-button
129+
plain
130+
@click="clickHandler">
131+
Show Notification
132+
</el-button>
133+
`
134+
})

src/stories/notification/notification.stories.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,41 @@ methods() {
140140
}
141141
```
142142

143+
```html
144+
<el-button
145+
plain
146+
@click="clickHandler">
147+
Show Notification
148+
</el-button>
149+
```
150+
151+
### Announcement Notification
152+
153+
Announcement messages are used for announcements.
154+
155+
<Story name="Announcement Notification">{stories.InfoNotification()}</Story>
156+
157+
#### Code
158+
159+
```js
160+
data() {
161+
return {
162+
notification : {
163+
message: 'Portal Announcement Notification.',
164+
showClose: true,
165+
iconClass: 'el-icon-info',
166+
customClass: 'el-message--info',
167+
duration: 5000
168+
}
169+
}
170+
},
171+
methods() {
172+
clickHandler() {
173+
this.$message(this.notification)
174+
}
175+
}
176+
```
177+
143178
```html
144179
<el-button
145180
plain

utils/notificationMessages.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ export const failMessage = message => {
2727
}
2828
}
2929

30+
/**
31+
* Information notification message object
32+
* @param {String} message
33+
* @return {Object}
34+
*/
35+
export const infoMessage = message => {
36+
return {
37+
message: message,
38+
showClose: true,
39+
iconClass: 'about-icon',
40+
customClass: 'el-message--info',
41+
duration: 5000
42+
}
43+
}
44+
3045
/**
3146
* Notification message object
3247
* @param {String} message

0 commit comments

Comments
 (0)