Skip to content

Commit

Permalink
feat(CvTextInputSkeleton): add initial skeleton implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusbandeiraa committed Oct 11, 2023
1 parent 1e430a7 commit 866d349
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/components/CvTextInput/CvTextInput.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
storyParametersObject,
} from '../../global/storybook-utils';

import CvTextInput from '.';
import { CvTextInput, CvTextInputSkeleton } from '.';
import { ref } from 'vue';

export default {
Expand Down Expand Up @@ -243,3 +243,19 @@ Password.parameters = storyParametersObject(
template,
Password.args
);

const templateSkeleton = `<cv-text-input-skeleton v-bind='args'>`;
const TemplateSkeleton = args => {
return {
components: { CvTextInputSkeleton },
setup: () => ({ args }),
template: templateSkeleton,
};
};

export const Skeleton = TemplateSkeleton.bind({});
Skeleton.parameters = storyParametersObject(
Skeleton.parameters,
templateSkeleton,
Skeleton.args
);
14 changes: 14 additions & 0 deletions src/components/CvTextInput/CvTextInputSkeleton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<div :class="[`${carbonPrefix}--form-item`]">
<span
:class="[`${carbonPrefix}--label`, `${carbonPrefix}--skeleton`]"
></span>
<div
:class="[`${carbonPrefix}--text-input`, `${carbonPrefix}--skeleton`]"
></div>
</div>
</template>

<script setup>
import { carbonPrefix } from '../../global/settings';
</script>
3 changes: 2 additions & 1 deletion src/components/CvTextInput/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import CvTextInput from './CvTextInput.vue';
import CvTextInputSkeleton from './CvTextInputSkeleton.vue';

export { CvTextInput };
export { CvTextInput, CvTextInputSkeleton };
export default CvTextInput;

0 comments on commit 866d349

Please sign in to comment.