-
Notifications
You must be signed in to change notification settings - Fork 13
CSS
support-frontend uses Emotion for CSS, with core style tokens drawn from the Guardian's design system, Source.
Emotion is a CSS-in-JS library that enables us to write styles in our .tsx and .ts files and have these compiled to CSS at runtime. It makes it much simpler to write precise and component-scoped styles and easily find the source of styles applied to specific bits of our rendered HTML.
The support site was originally styled using SCSS and several pages that see less developer traffic are still using this for part or all of their styling.
Ideally styling should be done in the same .tsx file as the component itself. If either the style or component code is so complex that it makes the file excessively long to co-locate them, styles should be moved into a separate .ts file in the same folder.
Rather than creating shared style files between components as one might when writing SCSS or vanilla CSS, when working with Emotion your first move should always to try to share the styles through a component, whether that's making a single component that is more flexible and extensible and can cover more use cases, or creating a shared parent component. This avoids creating unwanted dependencies between components, and generally makes debugging CSS issues much, much easier.
There are a few exceptions for very high-level shared styles such as our reset, font loading code, and some shared constants. These can be found under assets/stylesheets/emotion
Style changes should be made using Emotion wherever possible, and if the time requirements of a task allow then the styles of components being updated or changed in older parts of the site should be actively migrated to Emotion. New .scss files should never be created outside of truly exceptional circumstances, and we should actively avoid making style changes within .scss files unless it is truly unavoidable due to time pressure or the complexity of the code.
- Redux Glossary
- Why Redux Toolkit?
- Writing state slices with Redux Toolkit
- Handling action side effects in Redux
- Presentational and Container Components
- Scoped actions and reducers
- Server Side Rendering
- Form validation
- CI build process
- Post deployment testing
- Post deployment test runbook
- TIP Real User Testing
- Code testing and validation
- Visual testing
- Testing Apple Pay locally
- Test Users
- Deploying to CODE
- Automated IT tests
- Deploying Fastly VCL Snippets
- Archived Components
- Authentication
- Switchboard
- How to make a fake contribution
- The epic and banner
- Environments
- Tech stack
- Supported browsers
- Contributions Internationalisation
- Payment method internationalisation in Guardian Weekly
- Print fulfilment/delivery
- Updating the acquisitions model
- Runscope testing
- Scala Steward for dependency management
- Alarm Investigations
- Ticker data
- Ophan
- Quantum Metric
- [Google Tag Manager] (https://github.com/guardian/support-frontend/wiki/Google-Tag-Manager)