Commit f9e486c
committed
Extract SVG images
Several affordances throughout the application are visualized through
[`<svg>` elements][mdn-svg]. Prior to this commit, they were declared
directly in the template HTML.
Some of the application's iconography was shared across several parts of
the interface. For instance, the commit history's `<summary>` element in
mobile dimensions shared the same icon `<svg>` elements as the file
diff's `<summary>` element.
To re-use the shared elements, this commit adds a dependency on the
[`middleman-inline_svg` gem][middleman-inline_svg], which reads files
from the `source/images` directory and renders the contents of files
inline as HTML, similar to what was done before.
The main value that `middleman-inline_svg` provides is that it affords
an opportunity for the rendering context to insert HTML attributes
(like [`class`][class] and [`role`][role]) or an SVG [`<title>`
element][svg-title].
To that end, this commit also [configures the extension][configuration]
to specify [`role="img"`][role-img] for each SVG, since each collection
of elements represents a single entity.
[mdn-svg]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg
[middleman-inline_svg]: https://github.com/thoughtbot/middleman-inline_svg#usage
[class]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
[role]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles
[svg-title]: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
[configuration]: https://github.com/thoughtbot/middleman-inline_svg#configuration
[role-img]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Role_Img1 parent 06969aa commit f9e486c
6 files changed
Lines changed: 15 additions & 6 deletions
File tree
- source
- commits
- images
- layouts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| |||
149 | 152 | | |
150 | 153 | | |
151 | 154 | | |
| 155 | + | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 45 | + | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
| |||
0 commit comments