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.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Creating Grid Components

  • Alex Libby

摘要

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.