Skip to content

Commit eadf46e

Browse files
committed
refactor: CImg, CImgLazy refactor:
- delete CImgLazy, - CImg: change rounded prop to shape
1 parent 282387e commit eadf46e

File tree

6 files changed

+6
-226
lines changed

6 files changed

+6
-226
lines changed

src/components/image/CImg.vue

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,8 @@ export default {
2626
height: [Number, String],
2727
block: Boolean,
2828
fluid: Boolean,
29-
// Gives fluid images class `w-100` to make them grow to fit container
3029
fluidGrow: Boolean,
31-
// rounded can be:
32-
// false: no rounding of corners
33-
// true: slightly rounded corners
34-
// 'top': top corners rounded
35-
// 'right': right corners rounded
36-
// 'bottom': bottom corners rounded
37-
// 'left': left corners rounded
38-
// 'circle': circle/oval
39-
rounded: {
40-
type: [Boolean, String],
41-
validator: val => {
42-
return ['', false, true, 'top','right','bottom','left','circle'].includes(val)
43-
}
44-
},
30+
shape: String,
4531
thumbnail: Boolean,
4632
align: {
4733
type: String,
@@ -69,14 +55,14 @@ export default {
6955
},
7056
imageClasses () {
7157
return [
72-
//animationClass is rendered in CImgLazy
58+
//animationClasses is rendered in CImgLazy
7359
this.animationClasses,
7460
this.alignClass,
7561
{
7662
'img-thumbnail': this.thumbnail,
7763
'img-fluid': this.fluid || this.fluidGrow,
7864
'w-100': this.fluidGrow,
79-
[`rounded${this.rounded===true?'':'-'+this.rounded}`]: this.rounded,
65+
[`${this.shape}`]: this.shape,
8066
'd-block': this.block
8167
}
8268
]

src/components/image/CImgLazy.vue

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/components/image/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import CImg from './CImg'
2-
// import CImgLazy from './CImgLazy'
32

43
export {
5-
CImg,
6-
// CImgLazy
4+
CImg
75
}

src/components/image/tests/CImg.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const customWrapper = mount(Component, {
1111
height: 200,
1212
block: true,
1313
fluidGrow: true,
14-
rounded: 'right',
14+
shape: 'rounded-right',
1515
// thumbnail: true,
1616
align: 'right',
1717
placeholderColor: 'red'
@@ -37,7 +37,7 @@ describe(ComponentName, () => {
3737
})
3838
it('changes rounding properly', () => {
3939
expect(customWrapper.classes().includes('rounded-right')).toBe(true)
40-
customWrapper.setProps({ rounded: true})
40+
customWrapper.setProps({ shape: 'rounded'})
4141
expect(customWrapper.classes().includes('rounded')).toBe(true)
4242
})
4343
})

src/components/image/tests/CImgLazy.spec.js

Lines changed: 0 additions & 96 deletions
This file was deleted.

src/components/image/tests/__snapshots__/CImgLazy.spec.js.snap

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)