@@ -98,6 +98,8 @@ const appSizeQuery: UseApiQueryResult<ResponseType, RequestError> = useApiQuery<
9898- Use [ core components] ( ./app/components/core/ ) whenever possible. Use Emotion (styled components) only in edge cases.
9999- Use Text, Heading, Flex, Grid, Stack, Container and other core typography/layout components whenever possible.
100100- Add stories whenever possible (\* .stories.tsx).
101+ - Icons should be part of our icon set at static/app/icons and never inlined
102+ - Images should be placed inside static/app/images and imported via loader
101103
102104### Core components
103105
@@ -408,6 +410,54 @@ function Component() {
408410}
409411```
410412
413+ ### Images and Icons
414+
415+ Place all icons in the static/app/icons folder. Never inline SVGs or add them to any other folder. Optimize SVGs using svgo or svgomg
416+
417+ ```tsx
418+ // ❌ Never inline SVGs
419+ function Component(){
420+ return (
421+ <Button icon = {
422+ <svg viewbox = " 0 0 16 16>" }>
423+ // ❌ paths have excessive precision, optimize them with SVGO
424+ <circle cx = " 8.00134" cy = " 8.4314" r = " 5.751412" />
425+ <circle cx = " 8.00134" cy = " 8.4314" r = " 12.751412" />
426+ <line x1 = " 8.41334" y1 = " 5.255361" x2 = " 8" y2 = " 8.255421" />
427+ < / svg >
428+ < / Button >
429+ )
430+ }
431+
432+ // ❌ Never place SVGs outside of icons folder.
433+ import { CustomIcon } from " ./customIcon"
434+
435+ // ✅ Import icon from our icon set
436+ import { IconExclamation } from " sentry/icons"
437+ ```
438+
439+ ```tsx
440+ // ❌ All images belong inside static/app/images
441+
442+ // ✅ Images are imported from sentry-images alias
443+ import image from ' sentry-images/example.png' ;
444+
445+ import image from ' ./image.png' ;
446+
447+ function Component() {
448+ return <Image src = { image } />;
449+ }
450+
451+ // ❌ All images need to be imported usign the webpack loader!
452+ function Component() {
453+ return <Image src = " /path/to/image.png" />;
454+ }
455+
456+ function Component() {
457+ return <Image src = { image } />;
458+ }
459+ ```
460+
411461## React Testing Guidelines
412462
413463### Running Tests
0 commit comments