Creating Grid Components
摘要
This chapter is something of an oddity – you might be surprised to learn that we only create one component in this chapter as such, but in reality, we create three in total! Our component for this chapter is ImageGrid, where we display a predefined number of images in a grid (no surprise, Sherlock!). However, because we use CSS Grid, and owing to the limitations of Web Components/Storybook, we need to split it into three components. This splitting is not bad, as it makes them all lightweight. In this chapter, I’ll show you how we achieve this and highlight how easy it is to use the CSS Grid to create a useful component (or three) in Svelte.