Skip to content

Commit

Permalink
fix(kskeleton): delay-milliseconds default to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Apr 19, 2022
1 parent bf3ce44 commit 7ffa180
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
1 change: 1 addition & 0 deletions TEMP-MIGRATION-CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default defineConfig({

### KSkeleton
- Renamed internal component from `Skeleton` to `SkeletonBase`
- `delayMilliseconds` prop defaults to `0`

### KPrompt

Expand Down
6 changes: 3 additions & 3 deletions docs/components/skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ There are 5 different types of loading states that KSkeleton supports: Card, Tab

### delayMilliseconds

The number of milliseconds to wait before showing the skeleton state. Defaults to 750.
The number of milliseconds to wait before showing the skeleton state. Defaults to `0`.

<KComponent :data="{ isLoading: false }" v-slot="{ data }">
<div>
<KButton class="mb-2" @click="()=>(data.isLoading=!data.isLoading)">Toggle loading - {{data.isLoading?'on':'off'}}</KButton>
<div v-if="!data.isLoading">
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
</div>
<KSkeleton v-else="data.isLoading" />
<KSkeleton v-else="data.isLoading" delay-milliseconds="200" />
</div>
</KComponent>

Expand All @@ -37,7 +37,7 @@ The number of milliseconds to wait before showing the skeleton state. Defaults t
<div v-if="!data.isLoading">
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
</div>
<KSkeleton v-else="data.isLoading" />
<KSkeleton v-else="data.isLoading" delay-milliseconds="200" />
</div>
</KComponent>
```
Expand Down
11 changes: 1 addition & 10 deletions src/components/KSkeleton/KSkeleton.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import KSkeleton from '@/components/KSkeleton/KSkeleton.vue'
describe('KSkeleton', () => {
describe('variants', () => {
it('renders generic skeleton state by default', () => {
mount(KSkeleton, {
props: {
delayMilliseconds: 0,
},
})
mount(KSkeleton)

cy.get('.skeleton-loader').should('exist')
})
Expand All @@ -20,7 +16,6 @@ describe('KSkeleton', () => {
mount(KSkeleton, {
props: {
type: 'form',
delayMilliseconds: 0,
},
})

Expand All @@ -33,7 +28,6 @@ describe('KSkeleton', () => {
props: {
type: 'card',
cardCount: 2,
delayMilliseconds: 0,
},
})

Expand All @@ -45,7 +39,6 @@ describe('KSkeleton', () => {
mount(KSkeleton, {
props: {
type: 'table',
delayMilliseconds: 0,
},
})

Expand All @@ -57,7 +50,6 @@ describe('KSkeleton', () => {
mount(KSkeleton, {
props: {
type: 'spinner',
delayMilliseconds: 0,
},
})

Expand All @@ -68,7 +60,6 @@ describe('KSkeleton', () => {
mount(KSkeleton, {
props: {
type: 'fullscreen-kong',
delayMilliseconds: 0,
},
})

Expand Down
2 changes: 1 addition & 1 deletion src/components/KSkeleton/KSkeleton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default defineComponent({
delayMilliseconds: {
type: Number,
required: false,
default: 750,
default: 0,
},
type: {
type: String,
Expand Down

0 comments on commit 7ffa180

Please sign in to comment.