From 09dee69ee07f40a738bf8624867ceeb9ac619c6c Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Tue, 11 Feb 2020 10:07:16 +0100 Subject: [PATCH] rename PostCard to PostTeaser --- webapp/assets/_new/styles/tokens.scss | 2 +- .../NotificationsTable.story.js | 2 +- .../PostTeaser.spec.js} | 8 +- .../PostTeaser.story.js} | 14 +- .../PostTeaser.vue} | 123 +++++++++--------- .../_new/generic/BaseCard/BaseCard.vue | 14 ++ .../features/ReportList/ReportList.story.js | 2 +- webapp/pages/index.vue | 8 +- webapp/pages/post/_id/_slug/more-info.vue | 6 +- webapp/pages/profile/_id/_slug.vue | 6 +- 10 files changed, 99 insertions(+), 86 deletions(-) rename webapp/components/{PostCard/PostCard.spec.js => PostTeaser/PostTeaser.spec.js} (94%) rename webapp/components/{PostCard/PostCard.story.js => PostTeaser/PostTeaser.story.js} (91%) rename webapp/components/{PostCard/PostCard.vue => PostTeaser/PostTeaser.vue} (81%) diff --git a/webapp/assets/_new/styles/tokens.scss b/webapp/assets/_new/styles/tokens.scss index 90ec527ea..f56d75485 100644 --- a/webapp/assets/_new/styles/tokens.scss +++ b/webapp/assets/_new/styles/tokens.scss @@ -316,7 +316,7 @@ $z-index-page-submenu: 2500; $z-index-page-header: 2000; $z-index-page-sidebar: 1500; $z-index-sticky: 100; -$z-index-post-card-link: 5; +$z-index-post-teaser-link: 5; /** * @tokens Media Query diff --git a/webapp/components/NotificationsTable/NotificationsTable.story.js b/webapp/components/NotificationsTable/NotificationsTable.story.js index 84deb31c9..1d27f6532 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.story.js +++ b/webapp/components/NotificationsTable/NotificationsTable.story.js @@ -3,7 +3,7 @@ import { withA11y } from '@storybook/addon-a11y' import { action } from '@storybook/addon-actions' import NotificationsTable from '~/components/NotificationsTable/NotificationsTable' import helpers from '~/storybook/helpers' -import { post } from '~/components/PostCard/PostCard.story.js' +import { post } from '~/components/PostTeaser/PostTeaser.story.js' import { user } from '~/components/UserTeaser/UserTeaser.story.js' helpers.init() diff --git a/webapp/components/PostCard/PostCard.spec.js b/webapp/components/PostTeaser/PostTeaser.spec.js similarity index 94% rename from webapp/components/PostCard/PostCard.spec.js rename to webapp/components/PostTeaser/PostTeaser.spec.js index 28ce10b9e..e4b4dfe6f 100644 --- a/webapp/components/PostCard/PostCard.spec.js +++ b/webapp/components/PostTeaser/PostTeaser.spec.js @@ -2,14 +2,14 @@ import { config, shallowMount, mount, RouterLinkStub } from '@vue/test-utils' import Vuex from 'vuex' -import PostCard from './PostCard.vue' +import PostTeaser from './PostTeaser.vue' const localVue = global.localVue config.stubs['client-only'] = '' config.stubs['v-popover'] = '' -describe('PostCard', () => { +describe('PostTeaser', () => { let store let stubs let mocks @@ -55,7 +55,7 @@ describe('PostCard', () => { describe('shallowMount', () => { Wrapper = () => { store = new Vuex.Store({ getters }) - return shallowMount(PostCard, { + return shallowMount(PostTeaser, { store, propsData, mocks, @@ -99,7 +99,7 @@ describe('PostCard', () => { const store = new Vuex.Store({ getters, }) - return mount(PostCard, { + return mount(PostTeaser, { stubs, mocks, propsData, diff --git a/webapp/components/PostCard/PostCard.story.js b/webapp/components/PostTeaser/PostTeaser.story.js similarity index 91% rename from webapp/components/PostCard/PostCard.story.js rename to webapp/components/PostTeaser/PostTeaser.story.js index 5857167f3..e365289ff 100644 --- a/webapp/components/PostCard/PostCard.story.js +++ b/webapp/components/PostTeaser/PostTeaser.story.js @@ -1,6 +1,6 @@ import { storiesOf } from '@storybook/vue' import { withA11y } from '@storybook/addon-a11y' -import HcPostCard from './PostCard.vue' +import PostTeaser from './PostTeaser.vue' import helpers from '~/storybook/helpers' helpers.init() @@ -48,20 +48,20 @@ storiesOf('Post Card', module) .addDecorator(withA11y) .addDecorator(helpers.layout) .add('without image', () => ({ - components: { HcPostCard }, + components: { PostTeaser }, store: helpers.store, data: () => ({ post, }), template: ` - `, })) .add('with image', () => ({ - components: { HcPostCard }, + components: { PostTeaser }, store: helpers.store, data: () => ({ post: { @@ -70,14 +70,14 @@ storiesOf('Post Card', module) }, }), template: ` - `, })) .add('pinned by admin', () => ({ - components: { HcPostCard }, + components: { PostTeaser }, store: helpers.store, data: () => ({ post: { @@ -90,7 +90,7 @@ storiesOf('Post Card', module) }, }), template: ` - diff --git a/webapp/components/PostCard/PostCard.vue b/webapp/components/PostTeaser/PostTeaser.vue similarity index 81% rename from webapp/components/PostCard/PostCard.vue rename to webapp/components/PostTeaser/PostTeaser.vue index 363818730..0977690d0 100644 --- a/webapp/components/PostCard/PostCard.vue +++ b/webapp/components/PostTeaser/PostTeaser.vue @@ -6,19 +6,18 @@ -
+
-

{{ post.title }}

+

{{ post.title }}

@@ -67,7 +66,7 @@ import { mapGetters } from 'vuex' import { postMenuModalsData, deletePostMutation } from '~/components/utils/PostHelpers' export default { - name: 'HcPostCard', + name: 'PostTeaser', components: { UserTeaser, HcCategory, @@ -146,67 +145,67 @@ export default { height: 100%; color: $text-color-base; - .user-teaser { - margin-bottom: $space-small; - } - - > .base-card { - display: flex; - flex-direction: column; - height: 100%; - - &.--pinned { - border: 1px solid $color-warning; - } - - &.--blur-image > .card-image > .image { - filter: blur(22px); - } - - > .card-image { - overflow: hidden; - - > .image { - width: 100%; - object-fit: contain; - } - } - - > .content { - flex-grow: 1; - margin-bottom: $space-small; - } - - > .footer { - display: flex; - justify-content: space-between; - align-items: center; - - > .categories { - flex-grow: 1; - } - - > .counter-icon { - display: block; - margin-right: $space-small; - opacity: 0.5; - } - - > .content-menu { - position: relative; - z-index: $z-index-post-card-link; - } - - .ds-tag { - margin: 0; - } - } - } - > .ribbon { position: absolute; top: 50%; right: -7px; } } + +.post-teaser > .base-card { + display: flex; + flex-direction: column; + height: 100%; + + &.--pinned { + border: 1px solid $color-warning; + } + + &.--blur-image > .card-image > .image { + filter: blur(22px); + } + + > .card-image { + overflow: hidden; + + > .image { + width: 100%; + object-fit: contain; + } + } + + > .content { + flex-grow: 1; + margin-bottom: $space-small; + } + + > .footer { + display: flex; + justify-content: space-between; + align-items: center; + + > .categories { + flex-grow: 1; + } + + > .counter-icon { + display: block; + margin-right: $space-small; + opacity: 0.5; + } + + > .content-menu { + position: relative; + z-index: $z-index-post-teaser-link; + } + + .ds-tag { + margin: 0; + } + } + + .user-teaser { + margin-bottom: $space-small; + } +} diff --git a/webapp/components/_new/generic/BaseCard/BaseCard.vue b/webapp/components/_new/generic/BaseCard/BaseCard.vue index 6a97c47f1..31f2083b3 100644 --- a/webapp/components/_new/generic/BaseCard/BaseCard.vue +++ b/webapp/components/_new/generic/BaseCard/BaseCard.vue @@ -16,6 +16,20 @@ export default {} background-color: $color-neutral-100; box-shadow: $box-shadow-base; + &.--highlight { + border: $border-size-base solid $color-primary; + } + + &.--wide-content { + padding: $space-small; + + > .card-image { + width: calc(100% + (2 * #{$space-small})); + margin: -$space-small; + margin-bottom: $space-base; + } + } + > .card-image { width: calc(100% + (2 * #{$space-base})); margin: -$space-base; diff --git a/webapp/components/features/ReportList/ReportList.story.js b/webapp/components/features/ReportList/ReportList.story.js index aa188e8da..44b06d8fb 100644 --- a/webapp/components/features/ReportList/ReportList.story.js +++ b/webapp/components/features/ReportList/ReportList.story.js @@ -1,7 +1,7 @@ import { storiesOf } from '@storybook/vue' import { withA11y } from '@storybook/addon-a11y' import { action } from '@storybook/addon-actions' -import { post } from '~/components/PostCard/PostCard.story.js' +import { post } from '~/components/PostTeaser/PostTeaser.story.js' import { user } from '~/components/UserTeaser/UserTeaser.story.js' import helpers from '~/storybook/helpers' import ReportList from './ReportList' diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index 609c3d800..40bb31e46 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -1,7 +1,7 @@