Skip to content

Commit

Permalink
refactor(components): move premium components to separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
devCrossNet committed Jul 19, 2021
1 parent f694758 commit 0bc2e6c
Show file tree
Hide file tree
Showing 38 changed files with 41 additions and 23 deletions.
1 change: 1 addition & 0 deletions i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"auth.LoginForm.title": "Login Example",
"auth.LoginForm.username.error": "The username can not be empty",
"common.Apollo": "Apollo Example",
"common.Back-to-top": "Back to top",
"common.cancel": "Cancel",
"common.home": "Home",
"common.ok": "Ok",
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"auth.LoginForm.title": "Login Example",
"auth.LoginForm.username.error": "The username can not be empty",
"common.Apollo": "Apollo Example",
"common.Back-to-top": "Back to top",
"common.cancel": "Cancel",
"common.home": "Home",
"common.ok": "Ok",
Expand Down
8 changes: 4 additions & 4 deletions src/assets/design-system/variables/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
@import 'breakpoints';
/* Components */
@import 'components/organisms/accordion';
@import 'components/organisms/autocomplete';
@import 'components/premium/autocomplete';
@import 'components/data-display/badge';
@import 'components/molecules/breadcrumb';
@import 'components/input-and-actions/button';
@import 'components/organisms/calendar';
@import 'components/premium/calendar';
@import 'components/molecules/carousel';
@import 'components/input-and-actions/checkbox';
@import 'components/input-and-actions/radio';
@import 'components/organisms/data-table';
@import 'components/premium/data-table';
@import 'components/input-and-actions/dropdown';
@import 'components/organisms/footer';
@import 'components/input-and-actions/input';
Expand All @@ -32,7 +32,7 @@
@import 'components/organisms/tab-group';
@import 'components/molecules/tooltip';
@import 'components/input-and-actions/toggle';
@import 'components/atoms/star-rating';
@import 'components/premium/star-rating';
@import 'components/behavior/back-to-top';
@import 'components/molecules/pop-over';
@import 'components/data-display/menu';
14 changes: 11 additions & 3 deletions src/components/behavior/VueBackToTop/VueBackToTop.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Vue from 'vue';
import { fireEvent, render, RenderResult } from '@testing-library/vue';
import { triggerWindow } from '@/test/test-utils';
import { i18n } from '@/test/i18n';
import VueBackToTop from './VueBackToTop.vue';

describe('VueBackToTop.vue', () => {
Expand All @@ -11,14 +12,17 @@ describe('VueBackToTop.vue', () => {
(window as any).pageYOffset = 400;

harness = render(VueBackToTop, {
i18n,
stubs: ['nuxt-link'],
});
});

test('renders component', () => {
const { html } = harness;

expect(html()).toMatch('<button data-testid="back-to-top" class="vueBackToTop">');
expect(html()).toMatch(
'<button data-testid="back-to-top" type="button" aria-label="common.Back-to-top" class="vueBackToTop">',
);
});

test('it should scroll to top on click', async () => {
Expand All @@ -43,14 +47,18 @@ describe('VueBackToTop.vue', () => {

await Vue.nextTick();

expect(html()).toMatch('<button data-testid="back-to-top" class="vueBackToTop show">');
expect(html()).toMatch(
'<button data-testid="back-to-top" type="button" aria-label="common.Back-to-top" class="vueBackToTop show">',
);

(window as any).pageYOffset = 0;

triggerWindow.scroll();

await Vue.nextTick();

expect(html()).toMatch('<button data-testid="back-to-top" class="vueBackToTop">');
expect(html()).toMatch(
'<button data-testid="back-to-top" type="button" aria-label="common.Back-to-top" class="vueBackToTop">',
);
});
});
2 changes: 2 additions & 0 deletions src/components/behavior/VueBackToTop/VueBackToTop.stories.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { storiesOf } from '@storybook/vue';
import ComponentDocs from '@/assets/design-system/docs/components/ComponentDocs.vue';
import { i18n } from '@/test/i18n';
import VueBackToTop from './VueBackToTop.vue';

const story = storiesOf('Behavior|BackToTop', module) as any;

story.add(
'Default',
() => ({
i18n,
components: { VueBackToTop, ComponentDocs },
template: `<component-docs
component-name="BackToTop"
Expand Down
8 changes: 7 additions & 1 deletion src/components/behavior/VueBackToTop/VueBackToTop.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template>
<button :class="[$style.vueBackToTop, show && $style.show]" data-testid="back-to-top" @click="onClick">
<button
:class="[$style.vueBackToTop, show && $style.show]"
data-testid="back-to-top"
type="button"
:aria-label="$t('common.Back-to-top' /* Back to top */)"
@click="onClick"
>
<vue-icon-arrow-up />
</button>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { i18n } from '@/test/i18n';
import VueAutocomplete from './VueAutocomplete.vue';
import { AutocompleteFixture } from './IAutocompleteFixture';

const story = storiesOf('Organisms|Autocomplete', module) as any;
const story = storiesOf('Premium Components|Autocomplete', module) as any;

story.add(
'Default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export default defineComponent({
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.vueAutocomplete {
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { action } from '@storybook/addon-actions';
import { i18n } from '@/test/i18n';
import VueCalendar from './VueCalendar.vue';

const story = storiesOf('Organisms|Calendar', module) as any;
const story = storiesOf('Premium Components|Calendar', module) as any;

story.add(
'Default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ export default defineComponent({
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.calendar {
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import VueDropdown from '../../input-and-actions/VueDropdown/VueDropdown.vue';
import VueDataTable from './VueDataTable.vue';
import { dataTableDataFixture, dataTableHeaderFixture } from './DataTableFixtures';

const story = storiesOf('Organisms|DataTable', module) as any;
const story = storiesOf('Premium Components|DataTable', module) as any;

story.add(
'Default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export default {
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.container {
overflow-x: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.vueDataTableHeader {
border: $data-table-header-border;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.vueDataTableSearch {
padding-top: $space-12;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { action } from '@storybook/addon-actions';
import { i18n } from '@/test/i18n';
import VueDatePicker from './VueDatePicker.vue';

const story = storiesOf('Organisms|DatePicker', module) as any;
const story = storiesOf('Premium Components|DatePicker', module) as any;

story.add(
'Default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.vueDatePicker {
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { action } from '@storybook/addon-actions';
import { i18n } from '@/test/i18n';
import VueDateRangePicker from './VueDateRangePicker.vue';

const story = storiesOf('Organisms|DateRangePicker', module) as any;
const story = storiesOf('Premium Components|DateRangePicker', module) as any;

story.add(
'Default',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { storiesOf } from '@storybook/vue';
import VueStarRating from './VueStarRating.vue';

const story = storiesOf('Atoms|StarRating', module) as any;
const story = storiesOf('Premium Components|StarRating', module) as any;

story.add(
'Default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default defineComponent({
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.vueStarRating {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { storiesOf } from '@storybook/vue';
import { i18n } from '@/test/i18n';
import VueTruncate from './VueTruncate.vue';

const story = storiesOf('Molecules|Truncate', module) as any;
const story = storiesOf('Premium Components|Truncate', module) as any;

story.add(
'Default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default defineComponent({
</script>

<style lang="scss" module>
@import '~@/assets/design-system';
@import '~@/assets/_design-system';
.vueTruncate {
display: block;
Expand Down

0 comments on commit 0bc2e6c

Please sign in to comment.