| 1 |
import getIcon from '../../utils/get-icon'; |
| 2 |
import metadata from './block.json'; |
| 3 |
import edit from './edit'; |
| 4 |
import save from './save'; |
| 5 |
|
| 6 |
const { name } = metadata; |
| 7 |
|
| 8 |
export { metadata, name }; |
| 9 |
|
| 10 |
export const settings = { |
| 11 |
icon: getIcon('block-carousel', true), |
| 12 |
ghostkit: { |
| 13 |
previewUrl: 'https://www.ghostkit.io/docs/blocks/carousel/', |
| 14 |
customStylesCallback(attributes) { |
| 15 |
const { fadeEdges, fadeEdgesSize } = attributes; |
| 16 |
const styles = { |
| 17 |
'--gkt-carousel--fade-edges__size': undefined, |
| 18 |
}; |
| 19 |
|
| 20 |
if ( |
| 21 |
fadeEdges && |
| 22 |
typeof fadeEdgesSize !== 'undefined' && |
| 23 |
fadeEdgesSize !== '' |
| 24 |
) { |
| 25 |
styles['--gkt-carousel--fade-edges__size'] = |
| 26 |
`${fadeEdgesSize}%`; |
| 27 |
} |
| 28 |
|
| 29 |
return styles; |
| 30 |
}, |
| 31 |
}, |
| 32 |
example: { |
| 33 |
attributes: { |
| 34 |
slides: 3, |
| 35 |
}, |
| 36 |
innerBlocks: [ |
| 37 |
{ |
| 38 |
name: 'ghostkit/carousel-slide', |
| 39 |
innerBlocks: [ |
| 40 |
{ |
| 41 |
name: 'core/image', |
| 42 |
attributes: { |
| 43 |
sizeSlug: 'large', |
| 44 |
url: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg', |
| 45 |
}, |
| 46 |
}, |
| 47 |
], |
| 48 |
}, |
| 49 |
{ |
| 50 |
name: 'ghostkit/carousel-slide', |
| 51 |
innerBlocks: [ |
| 52 |
{ |
| 53 |
name: 'core/image', |
| 54 |
attributes: { |
| 55 |
sizeSlug: 'large', |
| 56 |
url: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg', |
| 57 |
}, |
| 58 |
}, |
| 59 |
], |
| 60 |
}, |
| 61 |
{ |
| 62 |
name: 'ghostkit/carousel-slide', |
| 63 |
}, |
| 64 |
], |
| 65 |
}, |
| 66 |
edit, |
| 67 |
save, |
| 68 |
}; |
| 69 |
|