refactor: rename empty component files and tags

This commit is contained in:
Javier López 2023-08-15 00:43:25 +02:00
parent 931b728c33
commit 8410972189
21 changed files with 62 additions and 62 deletions

View File

@ -2,5 +2,5 @@ import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the list of posts of this user is empty", () => { Then("the list of posts of this user is empty", () => {
cy.get(".base-card").not(".post-link"); cy.get(".base-card").not(".post-link");
cy.get(".main-container").find(".ds-space.hc-empty"); cy.get(".main-container").find(".ds-space.empty");
}); });

View File

@ -38,7 +38,7 @@ describe('Empty.vue', () => {
it('renders that message', () => { it('renders that message', () => {
propsData.message = 'this is a custom message for Empty component' propsData.message = 'this is a custom message for Empty component'
wrapper = Wrapper() wrapper = Wrapper()
expect(wrapper.find('.hc-empty-message').text()).toEqual(propsData.message) expect(wrapper.find('.empty-message').text()).toEqual(propsData.message)
}) })
}) })
@ -46,7 +46,7 @@ describe('Empty.vue', () => {
it('sets margin to that margin', () => { it('sets margin to that margin', () => {
propsData.margin = 'xxx-small' propsData.margin = 'xxx-small'
wrapper = Wrapper() wrapper = Wrapper()
expect(wrapper.find('.hc-empty').attributes().margin).toEqual(propsData.margin) expect(wrapper.find('.empty').attributes().margin).toEqual(propsData.margin)
}) })
}) })
}) })

View File

@ -1,6 +1,6 @@
import { storiesOf } from '@storybook/vue' import { storiesOf } from '@storybook/vue'
import { withA11y } from '@storybook/addon-a11y' import { withA11y } from '@storybook/addon-a11y'
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
import helpers from '~/storybook/helpers' import helpers from '~/storybook/helpers'
helpers.init() helpers.init()
@ -11,14 +11,14 @@ storiesOf('Empty', module)
.add( .add(
'tasks icon with message', 'tasks icon with message',
() => ({ () => ({
components: { HcEmpty }, components: { Empty },
template: '<hc-empty icon="tasks" message="Sorry, there are no ... available." />', template: '<empty icon="tasks" message="Sorry, there are no ... available." />',
}), }),
{ {
notes: "Possible icons include 'messages', 'events', 'alert', 'tasks', 'docs', and 'file'", notes: "Possible icons include 'messages', 'events', 'alert', 'tasks', 'docs', and 'file'",
}, },
) )
.add('default icon, no message', () => ({ .add('default icon, no message', () => ({
components: { HcEmpty }, components: { Empty },
template: '<hc-empty />', template: '<empty />',
})) }))

View File

@ -1,15 +1,15 @@
<template> <template>
<ds-space class="hc-empty" centered :margin="margin"> <ds-space class="empty" centered :margin="margin">
<ds-text> <ds-text>
<img <img
:src="iconPath" :src="iconPath"
width="80" width="80"
class="hc-empty-icon" class="empty-icon"
style="margin-bottom: 5px" style="margin-bottom: 5px"
alt="Empty" alt="Empty"
/> />
<br /> <br />
<ds-text v-show="message" class="hc-empty-message" color="softer"> <ds-text v-show="message" class="empty-message" color="softer">
{{ message }} {{ message }}
</ds-text> </ds-text>
</ds-text> </ds-text>
@ -18,7 +18,7 @@
<script> <script>
export default { export default {
name: 'HcEmpty', name: 'Empty',
props: { props: {
/** /**
* Icon that should be shown * Icon that should be shown
@ -55,7 +55,7 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.hc-empty-icon { .empty-icon {
padding-bottom: $font-space-large; padding-bottom: $font-space-large;
} }
</style> </style>

View File

@ -48,8 +48,8 @@ describe('NotificationsTable.vue', () => {
}) })
describe('no notifications', () => { describe('no notifications', () => {
it('renders HcEmpty component', () => { it('renders Empty component', () => {
expect(wrapper.find('.hc-empty').exists()).toBe(true) expect(wrapper.find('.empty').exists()).toBe(true)
}) })
}) })

View File

@ -97,11 +97,11 @@
</ds-grid-item> </ds-grid-item>
</ds-grid> </ds-grid>
</div> </div>
<hc-empty v-else icon="alert" :message="$t('notifications.empty')" /> <empty v-else icon="alert" :message="$t('notifications.empty')" />
</template> </template>
<script> <script>
import UserTeaser from '~/components/UserTeaser/UserTeaser' import UserTeaser from '~/components/UserTeaser/UserTeaser'
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
import BaseCard from '../_new/generic/BaseCard/BaseCard.vue' import BaseCard from '../_new/generic/BaseCard/BaseCard.vue'
import mobile from '~/mixins/mobile' import mobile from '~/mixins/mobile'
@ -110,7 +110,7 @@ const maxMobileWidth = 768 // at this point the table breaks down
export default { export default {
components: { components: {
UserTeaser, UserTeaser,
HcEmpty, Empty,
BaseCard, BaseCard,
}, },
mixins: [mobile(maxMobileWidth)], mixins: [mobile(maxMobileWidth)],

View File

@ -1,18 +1,18 @@
<template> <template>
<ds-space centered> <ds-space centered>
<hc-empty icon="events" :message="$t('components.registration.signup.unavailable')" /> <empty icon="events" :message="$t('components.registration.signup.unavailable')" />
<slot></slot> <slot></slot>
<ds-space margin="xxx-small" /> <ds-space margin="xxx-small" />
</ds-space> </ds-space>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
name: 'RegistrationSlideNoPublic', name: 'RegistrationSlideNoPublic',
components: { components: {
HcEmpty, Empty,
}, },
props: { props: {
sliderData: { type: Object, required: true }, sliderData: { type: Object, required: true },

View File

@ -50,8 +50,8 @@ describe('SearchResults', () => {
describe('searchResults', () => { describe('searchResults', () => {
describe('contains no results', () => { describe('contains no results', () => {
it('renders hc-empty component', () => { it('renders empty component', () => {
expect(wrapper.find('.hc-empty').exists()).toBe(true) expect(wrapper.find('.empty').exists()).toBe(true)
}) })
}) })

View File

@ -98,7 +98,7 @@
<!-- no results --> <!-- no results -->
<ds-grid-item v-else :row-span="7" column-span="fullWidth"> <ds-grid-item v-else :row-span="7" column-span="fullWidth">
<ds-space centered> <ds-space centered>
<hc-empty icon="tasks" :message="$t('search.no-results', { search })" /> <empty icon="tasks" :message="$t('search.no-results', { search })" />
</ds-space> </ds-space>
</ds-grid-item> </ds-grid-item>
</masonry-grid> </masonry-grid>
@ -109,7 +109,7 @@
<script> <script>
import postListActions from '~/mixins/postListActions' import postListActions from '~/mixins/postListActions'
import { searchPosts, searchUsers, searchGroups, searchHashtags } from '~/graphql/Search.js' import { searchPosts, searchUsers, searchGroups, searchHashtags } from '~/graphql/Search.js'
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid' import MasonryGrid from '~/components/MasonryGrid/MasonryGrid'
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem' import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem'
import PostTeaser from '~/components/PostTeaser/PostTeaser' import PostTeaser from '~/components/PostTeaser/PostTeaser'
@ -123,7 +123,7 @@ export default {
name: 'SearchResults', name: 'SearchResults',
components: { components: {
TabNavigation, TabNavigation,
HcEmpty, Empty,
MasonryGrid, MasonryGrid,
MasonryGridItem, MasonryGridItem,
PostTeaser, PostTeaser,

View File

@ -1,7 +1,7 @@
import faker from '@faker-js/faker' import faker from '@faker-js/faker'
import { storiesOf } from '@storybook/vue' import { storiesOf } from '@storybook/vue'
import { withA11y } from '@storybook/addon-a11y' import { withA11y } from '@storybook/addon-a11y'
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid' import MasonryGrid from '~/components/MasonryGrid/MasonryGrid'
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem' import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem'
import PostTeaser from '~/components/PostTeaser/PostTeaser' import PostTeaser from '~/components/PostTeaser/PostTeaser'
@ -66,7 +66,7 @@ storiesOf('TabNavigator', module)
.add('given search results of posts, users, hashtags', () => ({ .add('given search results of posts, users, hashtags', () => ({
components: { components: {
TabNavigation, TabNavigation,
HcEmpty, Empty,
MasonryGrid, MasonryGrid,
MasonryGridItem, MasonryGridItem,
PostTeaser, PostTeaser,
@ -178,7 +178,7 @@ storiesOf('TabNavigator', module)
<!-- no results --> <!-- no results -->
<ds-grid-item v-else :row-span="7" column-span="fullWidth"> <ds-grid-item v-else :row-span="7" column-span="fullWidth">
<ds-space centered> <ds-space centered>
<hc-empty icon="tasks" :message="$t('search.no-results', { search })" /> <empty icon="tasks" :message="$t('search.no-results', { search })" />
</ds-space> </ds-space>
</ds-grid-item> </ds-grid-item>
</masonry-grid> </masonry-grid>

View File

@ -28,16 +28,16 @@
<report-row :key="report.id" :report="report" @confirm-report="$emit('confirm', report)" /> <report-row :key="report.id" :report="report" @confirm-report="$emit('confirm', report)" />
</template> </template>
</table> </table>
<hc-empty v-else icon="alert" :message="$t('moderation.reports.empty')" /> <empty v-else icon="alert" :message="$t('moderation.reports.empty')" />
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
import ReportRow from '~/components/features/ReportRow/ReportRow' import ReportRow from '~/components/features/ReportRow/ReportRow'
export default { export default {
components: { components: {
HcEmpty, Empty,
ReportRow, ReportRow,
}, },
props: { props: {

View File

@ -1,16 +1,16 @@
<template> <template>
<base-card> <base-card>
<h2 class="title">{{ $t('admin.notifications.name') }}</h2> <h2 class="title">{{ $t('admin.notifications.name') }}</h2>
<hc-empty icon="tasks" message="Coming Soon…" /> <empty icon="tasks" message="Coming Soon…" />
</base-card> </base-card>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
components: { components: {
HcEmpty, Empty,
}, },
} }
</script> </script>

View File

@ -1,16 +1,16 @@
<template> <template>
<base-card> <base-card>
<h2 class="title">{{ $t('admin.organizations.name') }}</h2> <h2 class="title">{{ $t('admin.organizations.name') }}</h2>
<hc-empty icon="tasks" message="Coming Soon…" /> <empty icon="tasks" message="Coming Soon…" />
</base-card> </base-card>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
components: { components: {
HcEmpty, Empty,
}, },
} }
</script> </script>

View File

@ -1,16 +1,16 @@
<template> <template>
<base-card> <base-card>
<h2 class="title">{{ $t('admin.pages.name') }}</h2> <h2 class="title">{{ $t('admin.pages.name') }}</h2>
<hc-empty icon="tasks" message="Coming Soon…" /> <empty icon="tasks" message="Coming Soon…" />
</base-card> </base-card>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
components: { components: {
HcEmpty, Empty,
}, },
} }
</script> </script>

View File

@ -1,16 +1,16 @@
<template> <template>
<base-card> <base-card>
<h2 class="title">{{ $t('admin.settings.name') }}</h2> <h2 class="title">{{ $t('admin.settings.name') }}</h2>
<hc-empty icon="tasks" message="Coming Soon…" /> <empty icon="tasks" message="Coming Soon…" />
</base-card> </base-card>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
components: { components: {
HcEmpty, Empty,
}, },
} }
</script> </script>

View File

@ -121,7 +121,7 @@
</template> </template>
<template v-else> <template v-else>
<ds-grid-item :row-span="2" column-span="fullWidth"> <ds-grid-item :row-span="2" column-span="fullWidth">
<hc-empty icon="docs" /> <empty icon="docs" />
<ds-text align="center">{{ $t('index.no-results') }}</ds-text> <ds-text align="center">{{ $t('index.no-results') }}</ds-text>
<ds-text align="center">{{ $t('index.change-filter-settings') }}</ds-text> <ds-text align="center">{{ $t('index.change-filter-settings') }}</ds-text>
</ds-grid-item> </ds-grid-item>
@ -140,7 +140,7 @@ import postListActions from '~/mixins/postListActions'
import mobile from '~/mixins/mobile' import mobile from '~/mixins/mobile'
import DonationInfo from '~/components/DonationInfo/DonationInfo.vue' import DonationInfo from '~/components/DonationInfo/DonationInfo.vue'
import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter.vue' import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter.vue'
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
import PostTeaser from '~/components/PostTeaser/PostTeaser.vue' import PostTeaser from '~/components/PostTeaser/PostTeaser.vue'
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue' import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue' import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
@ -158,7 +158,7 @@ export default {
DonationInfo, DonationInfo,
HashtagsFilter, HashtagsFilter,
PostTeaser, PostTeaser,
HcEmpty, Empty,
MasonryGrid, MasonryGrid,
MasonryGridItem, MasonryGridItem,
FilterMenuComponent, FilterMenuComponent,

View File

@ -168,7 +168,7 @@
</template> </template>
<template v-else> <template v-else>
<ds-grid-item column-span="fullWidth"> <ds-grid-item column-span="fullWidth">
<hc-empty margin="xx-large" icon="file" /> <empty margin="xx-large" icon="file" />
</ds-grid-item> </ds-grid-item>
</template> </template>
</masonry-grid> </masonry-grid>
@ -189,7 +189,7 @@ import HcFollowButton from '~/components/Button/FollowButton'
import HcCountTo from '~/components/CountTo.vue' import HcCountTo from '~/components/CountTo.vue'
import HcBadges from '~/components/Badges.vue' import HcBadges from '~/components/Badges.vue'
import FollowList, { followListVisibleCount } from '~/components/features/ProfileList/FollowList' import FollowList, { followListVisibleCount } from '~/components/features/ProfileList/FollowList'
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
import ContentMenu from '~/components/ContentMenu/ContentMenu' import ContentMenu from '~/components/ContentMenu/ContentMenu'
import AvatarUploader from '~/components/Uploader/AvatarUploader' import AvatarUploader from '~/components/Uploader/AvatarUploader'
import ProfileAvatar from '~/components/_new/generic/ProfileAvatar/ProfileAvatar' import ProfileAvatar from '~/components/_new/generic/ProfileAvatar/ProfileAvatar'
@ -218,7 +218,7 @@ export default {
HcFollowButton, HcFollowButton,
HcCountTo, HcCountTo,
HcBadges, HcBadges,
HcEmpty, Empty,
ProfileAvatar, ProfileAvatar,
ContentMenu, ContentMenu,
AvatarUploader, AvatarUploader,

View File

@ -90,7 +90,7 @@ describe('Registration', () => {
it('no "method" query in URI show "RegistrationSlideNoPublic"', async () => { it('no "method" query in URI show "RegistrationSlideNoPublic"', async () => {
mocks.$route.query = {} mocks.$route.query = {}
wrapper = await Wrapper() wrapper = await Wrapper()
expect(wrapper.find('.hc-empty').exists()).toBe(true) expect(wrapper.find('.empty').exists()).toBe(true)
expect(wrapper.find('.enter-invite').exists()).toBe(false) expect(wrapper.find('.enter-invite').exists()).toBe(false)
expect(wrapper.find('.enter-email').exists()).toBe(false) expect(wrapper.find('.enter-email').exists()).toBe(false)
}) })
@ -127,13 +127,13 @@ describe('Registration', () => {
it('no "inviteCode" query in URI', async () => { it('no "inviteCode" query in URI', async () => {
mocks.$route.query = { method: 'invite-code' } mocks.$route.query = { method: 'invite-code' }
wrapper = await Wrapper() wrapper = await Wrapper()
expect(wrapper.find('.hc-empty').exists()).toBe(true) expect(wrapper.find('.empty').exists()).toBe(true)
}) })
it('"inviteCode=ABCDEF" query in URI', async () => { it('"inviteCode=ABCDEF" query in URI', async () => {
mocks.$route.query = { method: 'invite-code', inviteCode: 'ABCDEF' } mocks.$route.query = { method: 'invite-code', inviteCode: 'ABCDEF' }
wrapper = await Wrapper() wrapper = await Wrapper()
expect(wrapper.find('.hc-empty').exists()).toBe(true) expect(wrapper.find('.empty').exists()).toBe(true)
}) })
}) })
}) })

View File

@ -1,16 +1,16 @@
<template> <template>
<base-card> <base-card>
<h2 class="title">{{ $t('settings.invites.name') }}</h2> <h2 class="title">{{ $t('settings.invites.name') }}</h2>
<hc-empty icon="tasks" message="Coming Soon…" /> <empty icon="tasks" message="Coming Soon…" />
</base-card> </base-card>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
components: { components: {
HcEmpty, Empty,
}, },
} }
</script> </script>

View File

@ -1,16 +1,16 @@
<template> <template>
<base-card> <base-card>
<h2 class="title">{{ $t('settings.languages.name') }}</h2> <h2 class="title">{{ $t('settings.languages.name') }}</h2>
<hc-empty icon="tasks" message="Coming Soon…" /> <empty icon="tasks" message="Coming Soon…" />
</base-card> </base-card>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
components: { components: {
HcEmpty, Empty,
}, },
} }
</script> </script>

View File

@ -1,16 +1,16 @@
<template> <template>
<base-card> <base-card>
<h2 class="title">{{ $t('settings.organizations.name') }}</h2> <h2 class="title">{{ $t('settings.organizations.name') }}</h2>
<hc-empty icon="tasks" message="Coming Soon…" /> <empty icon="tasks" message="Coming Soon…" />
</base-card> </base-card>
</template> </template>
<script> <script>
import HcEmpty from '~/components/Empty/Empty' import Empty from '~/components/Empty/Empty'
export default { export default {
components: { components: {
HcEmpty, Empty,
}, },
} }
</script> </script>