-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14641 from CartoDB/product208-tagslist
[New Dashboard] Tags list in Home Page
- Loading branch information
Showing
15 changed files
with
244 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ a { | |
} | ||
|
||
.button--ghost { | ||
background: $white; | ||
background: transparent; | ||
color: $primary-color; | ||
} | ||
|
||
|
6 changes: 6 additions & 0 deletions
6
lib/assets/javascripts/new-dashboard/assets/icons/section-title/tags.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions
47
lib/assets/javascripts/new-dashboard/components/TagCard.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<router-link :to="{ name: 'tagSearch', params: { tag: tag.tag } }" class="link"> | ||
<article class="card tag"> | ||
<h3 class="tag__title title is-medium is-semibold">{{ tag.tag }}</h3> | ||
<ul> | ||
<li class="tag__count text is-caption"> | ||
{{ $tc('TagCard.maps', tag.maps, { maps: tag.maps }) }} | ||
</li> | ||
<li class="tag__count text is-caption"> | ||
{{ $tc('TagCard.datasets', tag.datasets, { datasets: tag.datasets }) }} | ||
</li> | ||
</ul> | ||
</article> | ||
</router-link> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'TagCard', | ||
props: { | ||
tag: Object | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import 'stylesheets/new-dashboard/variables'; | ||
.card { | ||
position: relative; | ||
height: 100%; | ||
padding: 16px; | ||
transition: background 300ms cubic-bezier(0.4, 0, 0.2, 1); | ||
border: 1px solid $light-grey; | ||
background-color: $white; | ||
} | ||
.tag__title, | ||
.tag__count { | ||
margin-bottom: 8px; | ||
color: $text-color; | ||
} | ||
.link:hover { | ||
text-decoration: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
lib/assets/javascripts/new-dashboard/pages/Home/TagsSection/TagsSection.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<template> | ||
<section class="tags-section is-bgSoftBlue"> | ||
<div class="container"> | ||
<SectionTitle class="grid-cell" :title="$t('HomePage.TagsSection.title')"> | ||
<template slot="icon"> | ||
<img src="../../../assets/icons/section-title/tags.svg"> | ||
</template> | ||
|
||
<template slot="actionButton"> | ||
<button class="button button--small is-primary button--ghost" @click="goToRecentSection"> | ||
{{ $t('HomePage.TagsSection.viewRecentContentAction') }} | ||
</button> | ||
</template> | ||
</SectionTitle> | ||
|
||
<ul class="grid"> | ||
<li class="card grid-cell grid-cell--col4 grid-cell--col6--tablet grid-cell--col12--mobile tag-element" v-for="tag in tags" :key="tag.tag"> | ||
<TagCard :tag="tag" /> | ||
</li> | ||
</ul> | ||
</div> | ||
</section> | ||
</template> | ||
|
||
<script> | ||
import SectionTitle from 'new-dashboard/components/SectionTitle'; | ||
import TagCard from 'new-dashboard/components/TagCard.vue'; | ||
export default { | ||
name: 'TagsSection', | ||
components: { | ||
SectionTitle, | ||
TagCard | ||
}, | ||
data () { | ||
return { | ||
// TODO: Retrieve tags from API when endpoint is ready | ||
tags: [ | ||
{ | ||
tag: 'Blog', | ||
maps: 2, | ||
datasets: 3 | ||
}, | ||
{ | ||
tag: 'Catalog', | ||
maps: 1, | ||
datasets: 4 | ||
}, | ||
{ | ||
tag: 'Customer', | ||
maps: 3, | ||
datasets: 4 | ||
}, | ||
{ | ||
tag: 'David', | ||
maps: 3, | ||
datasets: 4 | ||
}, | ||
{ | ||
tag: 'Website', | ||
maps: 4, | ||
datasets: 1 | ||
}, | ||
{ | ||
tag: 'Production', | ||
maps: 2, | ||
datasets: 3 | ||
}, | ||
{ | ||
tag: 'Census', | ||
maps: 4, | ||
datasets: 3 | ||
}, | ||
{ | ||
tag: 'Client', | ||
maps: 2, | ||
datasets: 4 | ||
} | ||
] | ||
}; | ||
}, | ||
methods: { | ||
goToRecentSection () { | ||
this.$emit('sectionChange', 'RecentSection'); | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.tag-element { | ||
margin-bottom: 24px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/assets/test/spec/new-dashboard/unit/specs/components/TagCard.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { shallowMount } from '@vue/test-utils'; | ||
import TagCard from 'new-dashboard/components/TagCard'; | ||
|
||
const $tc = key => key; | ||
|
||
describe('TagCard', () => { | ||
it('should render properly', () => { | ||
const tagCardElement = shallowMount(TagCard, { | ||
propsData: { | ||
tag: { | ||
tag: 'Test Tag', | ||
maps: 1, | ||
datasets: 3 | ||
} | ||
}, | ||
mocks: { | ||
$tc | ||
} | ||
}); | ||
|
||
expect(tagCardElement).toMatchSnapshot(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
lib/assets/test/spec/new-dashboard/unit/specs/components/__snapshots__/TagCard.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`TagCard should render properly 1`] = ` | ||
<router-link to="[object Object]" class="link"> | ||
<article class="card tag"> | ||
<h3 class="tag__title title is-medium is-semibold">Test Tag</h3> | ||
<ul> | ||
<li class="tag__count text is-caption"> | ||
TagCard.maps | ||
</li> | ||
<li class="tag__count text is-caption"> | ||
TagCard.datasets | ||
</li> | ||
</ul> | ||
</article> | ||
</router-link> | ||
`; |
Oops, something went wrong.