Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CvFileUploadSkeleton component #228

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/components/cv-file-uploader/cv-file-uploader-skeleton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<div class="bx--form-item">
<cv-skeleton-text heading width="100px" />
<cv-skeleton-text width="225px" class="bx--label-descriptio" />
<cv-button-skeleton />
</div>
</template>

<script>
import CvSkeletonText from '../cv-skeleton-text/cv-skeleton-text';
import CvButtonSkeleton from '../cv-button/cv-button-skeleton';

export default {
name: 'CvFileUploaderSkeleton',
components: {
CvSkeletonText,
CvButtonSkeleton,
},
};
</script>

<style lang="scss"></style>
47 changes: 44 additions & 3 deletions src/components/cv-file-uploader/cv-file-uploader-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import knobsHelper from '../../_storybook/utils/knobs-helper';

import CvFileUploaderNotesMD from './cv-file-uploader-notes.md';
import CvFileUploader from './cv-file-uploader';
import CvFileUploaderSkeleton from './cv-file-uploader-skeleton';

const stories = storiesOf('CvFileUploader', module);
stories.addDecorator(withKnobs);
stories.addDecorator(withNotes);

const preKnobs = {
let preKnobs = {
label: {
group: 'attr',
type: text,
Expand Down Expand Up @@ -73,14 +74,14 @@ const preKnobs = {
},
};

const variants = [
let variants = [
{ name: 'default', excludes: ['events', 'vModel'] },
{ name: 'minimal', includes: [] },
{ name: 'events', excludes: ['vModel'] },
{ name: 'vModel', excludes: ['events'] },
];

const storySet = knobsHelper.getStorySet(variants, preKnobs);
let storySet = knobsHelper.getStorySet(variants, preKnobs);

for (const story of storySet) {
stories.add(
Expand Down Expand Up @@ -155,3 +156,43 @@ for (const story of storySet) {
}
);
}

// cv-file-uploader-skeleton

preKnobs = {};

variants = [{ name: 'skeleton' }];

storySet = knobsHelper.getStorySet(variants, preKnobs);

for (const story of storySet) {
stories.add(
story.name,
() => {
const settings = story.knobs();

const templateString = `
<cv-file-uploader-skeleton></cv-file-uploader-skeleton>
`;

// ----------------------------------------------------------------

const templateViewString = `
<sv-template-view
sv-margin
sv-source='${templateString.trim()}'>
<template slot="component">${templateString}</template>
</sv-template-view>
`;

return {
components: { CvFileUploaderSkeleton, SvTemplateView },
template: templateViewString,
props: settings.props,
};
},
{
notes: { markdown: CvFileUploaderNotesMD },
}
);
}