Skip to content

Commit f334ba5

Browse files
authored
Merge pull request #4 from nih-sparc/IconCard
Icon card
2 parents ee3cb91 + 7d7cf9b commit f334ba5

File tree

3 files changed

+185
-3
lines changed

3 files changed

+185
-3
lines changed

src/App.vue

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@
5252
@click="openNotificationWithIcon">
5353
Show Notification with Icon
5454
</el-button>
55-
55+
<el-col>
56+
<el-row>
57+
<icon-card
58+
:title="iconCardData.title"
59+
:icons="iconCardData.icons"
60+
/>
61+
</el-row>
62+
</el-col>
5663
<el-table
5764
:data="tableData"
5865
:default-sort = "{prop: 'name', order: 'descending'}"
@@ -249,9 +256,87 @@
249256
import Pagination from './components/Pagination.vue'
250257
import PaginationMenu from './components/PaginationMenu.vue'
251258
import BreadcrumbTrail from './components/BreadcrumbTrail.vue'
259+
import IconCard from './components/IconCard.vue'
252260
import { ref } from 'vue'
253261
import { successMessage, infoMessage, failMessage, informationNotification, iconInformationNotification } from "../utils/notificationMessages"
254262
263+
264+
const iconCardData={
265+
title:'Browse Data By Category',
266+
icons: [{
267+
title: 'Bladder',
268+
image: 'https://via.placeholder.com/736',
269+
linkComponent: 'router-link',
270+
href: '/bladder'
271+
},
272+
{
273+
title: 'Colon',
274+
image: 'https://via.placeholder.com/736',
275+
linkComponent: 'router-link',
276+
href: '/colon'
277+
},
278+
{
279+
title: 'Esophogus',
280+
image: 'https://via.placeholder.com/736',
281+
linkComponent: 'router-link',
282+
href: '/esophogus'
283+
},
284+
{
285+
title: 'Female Reproductive System',
286+
image: 'https://via.placeholder.com/736',
287+
linkComponent: 'router-link',
288+
href: '/female-reproductive-system'
289+
},
290+
{
291+
title: 'Heart',
292+
image: 'https://via.placeholder.com/736',
293+
linkComponent: 'router-link',
294+
href: '/heart'
295+
},
296+
{
297+
title: 'Kidney',
298+
image: 'https://via.placeholder.com/736',
299+
linkComponent: 'router-link',
300+
href: '/kidney'
301+
},
302+
{
303+
title: 'Liver',
304+
image: 'https://via.placeholder.com/736',
305+
linkComponent: 'router-link',
306+
href: '/liver'
307+
},
308+
{
309+
title: 'Lungs',
310+
image: 'https://via.placeholder.com/736',
311+
linkComponent: 'router-link',
312+
href: '/lungs'
313+
},
314+
{
315+
title: 'Male Reproductive System',
316+
image: 'https://via.placeholder.com/736',
317+
linkComponent: 'router-link',
318+
href: '/male-reproductive-system'
319+
},
320+
{
321+
title: 'Small Intestine',
322+
image: 'https://via.placeholder.com/736',
323+
linkComponent: 'router-link',
324+
href: '/small-intestine'
325+
},
326+
{
327+
title: 'Spleen',
328+
image: 'https://via.placeholder.com/736',
329+
linkComponent: 'router-link',
330+
href: '/spleen'
331+
},
332+
{
333+
title: 'Stomach',
334+
image: 'https://via.placeholder.com/736',
335+
linkComponent: 'router-link',
336+
href: '/stomach'
337+
}]
338+
}
339+
255340
const tableData = [{
256341
"id": 37,
257342
"sourceDatasetId": 344,
@@ -752,7 +837,8 @@
752837
DropdownMultiselect,
753838
Pagination,
754839
PaginationMenu,
755-
BreadcrumbTrail
840+
BreadcrumbTrail,
841+
IconCard
756842
},
757843
name: 'App',
758844
setup() {
@@ -818,7 +904,8 @@
818904
pageSize,
819905
pageCount,
820906
selectedPage,
821-
breadcrumbs
907+
breadcrumbs,
908+
iconCardData
822909
}
823910
},
824911
methods: {

src/components/IconCard.vue

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<template>
2+
<div class="icon-card">
3+
<h2>{{title}}</h2>
4+
<div class="data-wrap">
5+
<component
6+
v-for="icon in icons"
7+
:is="icon.linkComponent"
8+
class="icon-card__item"
9+
:to="icon.href"
10+
:key="icon.title"
11+
>
12+
<img
13+
:src="icon.image"
14+
:alt="`Icon for ${icon.title} category`"
15+
/>
16+
<p class="mb-0 mt-8">
17+
{{ icon.title }}
18+
</p>
19+
</component>
20+
</div>
21+
</div>
22+
</template>
23+
24+
<script>
25+
export default {
26+
name: 'IconCard',
27+
28+
props: {
29+
icons: {
30+
type: Array,
31+
required: true
32+
},
33+
title: {
34+
type: String,
35+
default: ''
36+
}
37+
},
38+
}
39+
</script>
40+
41+
<style lang="scss" scoped>
42+
@import '../assets/_variables.scss';
43+
44+
.icon-card {
45+
text-align: center;
46+
padding: 3em 0 4em;
47+
background-color: $background;
48+
}
49+
h2 {
50+
margin-bottom: 1.5625em;
51+
}
52+
.data-wrap {
53+
align-items: flex-start;
54+
flex-wrap: wrap;
55+
display: flex;
56+
justify-content: center;
57+
@media (min-width: 768px) {
58+
padding-left: 0.4375rem;
59+
padding-right: 0.4375rem;
60+
}
61+
}
62+
.icon-card__item {
63+
color: #000;
64+
margin: 1rem 2rem;
65+
text-decoration: none;
66+
width: 12%;
67+
min-width: 70px;
68+
&:hover,
69+
&:focus {
70+
opacity: 0.9;
71+
}
72+
img {
73+
background: #fff;
74+
border-radius: 50%;
75+
display: block;
76+
height: auto;
77+
margin-bottom: 8px;
78+
width: 100%;
79+
@media (min-width: 768px) {
80+
height: 100%;
81+
}
82+
}
83+
p {
84+
font-size: 1em;
85+
font-weight: 700;
86+
color: $darkBlue;
87+
cursor: pointer;
88+
&:hover {
89+
text-decoration: underline;
90+
}
91+
}
92+
}
93+
</style>

src/components/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import DropdownMultiselect from './DropdownMultiselect/DropdownMultiselect.vue'
1010
import Pagination from './Pagination.vue'
1111
import PaginationMenu from './PaginationMenu.vue'
1212
import BreadCrumbTrail from './BreadcrumbTrail.vue'
13+
import IconCard from '.IconCard.vue'
1314

1415
export default {
1516
install(app) {
@@ -22,5 +23,6 @@ export default {
2223
app.component('Pagination', Pagination);
2324
app.component('PaginationMenu', PaginationMenu);
2425
app.component('BreadCrumbTrail', BreadCrumbTrail);
26+
app.component('IconCard', IconCard)
2527
},
2628
};

0 commit comments

Comments
 (0)