You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Creating a new component from the command line can be done by running the follow
37
37
$ yarn new-package
38
38
```
39
39
40
-
This will scaffold your component's required architecture by prompting you for 2 data points - the desired name for your package and the name of the Spectrum CSS asset from which you will be building.
40
+
This will scaffold your component's required architecture by prompting you for the desired name for your package.
41
41
42
42
? **SWC package name (i.e. color-area)**
43
43
@@ -134,7 +134,7 @@ Visual regression testing is done against screens derived from the exports of th
134
134
135
135
#### Keeping CI assets updated
136
136
137
-
If you find the `visual-*` jobs failing on CircleCI for reasons that you expect (you've updated the Spectrum CSS dependencies, you've added new tests, etc.) then you will need to update the golden images cache key before your build will pass. You can review and share the diffs for a test pass via a URL shaped like `vrt--spectrum-wc.netlify.app/${branchName}`. Before updating the cache key, be sure that the updated caches are both complete (there are times when process errors prevent images from being correctly created or when certain test passes take longer than others) and appear as expected. If you agree with the updated cache content, update the golden images cache key as follows.
137
+
If you find the `visual-*` jobs failing on CircleCI for reasons that you expect (you've updated components css, you've added new tests, etc.) then you will need to update the golden images cache key before your build will pass. You can review and share the diffs for a test pass via a URL shaped like `vrt--spectrum-wc.netlify.app/${branchName}`. Before updating the cache key, be sure that the updated caches are both complete (there are times when process errors prevent images from being correctly created or when certain test passes take longer than others) and appear as expected. If you agree with the updated cache content, update the golden images cache key as follows.
138
138
139
139
Your failing branch will have created a new cache with a key of `v1-golden-images-{{ .Revision }}-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.dir >>-{{ epoch }}`. Here `{{ .Revision }}` outlines the git commit hash of the current CI pass. In `.circleci/config.yml`, you will use that to update the cache that is requested at the beginning of the `run-regressions` job. As part of the review site, the git commit hash will be listed in the side navigation UI for easy access, use this number to update the `current_golden_images_hash` paramater that appears as follows:
Copy file name to clipboardExpand all lines: STYLING.md
+45-7Lines changed: 45 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,58 @@ This document outlines the details of the CSS styling for Spectrum Web Component
6
6
7
7
For each component in the project, there are upto 3 CSS files:
8
8
9
-
-`spectrum-[component-name].css` - This is the CSS file for the component that is generated by the last build from the Spectrum CSS project before the cutoff.
10
-
-`[component-name]-overrides.css` - This is the CSS file for the component that contains the system overrides for the component. It was also generated by the last build from the Spectrum CSS project before the cutoff.
11
-
-`[component-name].css` - This is the main CSS file which imports the `spectrum-[component-name].css` and `[component-name]-overrides.css` files and additionally contains the component's custom styles.
9
+
-`spectrum-[component-name].css` - This is the main CSS file for the component that is generated by the last build from the Spectrum CSS project before the cutoff.
10
+
-`[component-name]-overrides.css` - This is the CSS file for the component that contains the system overrides which take different values in different themes. It was also generated by the last build from the Spectrum CSS project before the cutoff.
11
+
-`[component-name].css` - This is the main CSS file which imports the `spectrum-[component-name].css` and `[component-name]-overrides.css` files and additionally contains the component's custom styles which are not part of the Spectrum CSS project.
12
12
13
13
### How to update the component styling
14
14
15
15
We will try to keep the concerns separate for the component styling and so depending on the changes, we will need to update the component styling in the following ways:
16
16
17
17
- If it's a fix to the core visual structure or token usage, it belongs in `spectrum-[component-name].css`.
18
-
- If it's system-specific, it goes to `[component-name]-overrides.css`.
19
18
- If it's something unique to SWC or a workaround, then `[component-name].css` is acceptable — but should be reviewed for long-term cleanup.
20
19
21
-
## Global styling (WIP)
20
+
The process to update these two css files is the same and is as follows:
22
21
23
-
SWC project uses styles package to manage the global css tokens for all three themes. The styles package can be found in `tools/styles`.
22
+
Example:
24
23
25
-
Hopefully, we'd never need to edit the styles package directly as these files were built from the processing of tokens package in the spectrum-css project before the cutoff.
This will just work! As long as the `--spectrum-component-height-300` variable exists in the tokens package.
32
+
33
+
- If it's an update to how a component looks in one particular theme, it belongs in `[component-name]-overrides.css`.
34
+
35
+
The process to update the overrides file involves a few extra steps:
36
+
37
+
1. Update the `[component-name]-overrides.css` file to contain the new styles.
38
+
2. Make sure the new `--system-` variable exists in the tokens package. This variable can be found in the `tools/styles/tokens/[express | spectrum]/system-theme-bridge.css` file or the `tools/styles/tokens-v2/system-theme-bridge.css` file depending on the theme.
39
+
3. If the variable doesn't exist, we will need to add it to the correct file.
40
+
41
+
## Global styling
42
+
43
+
SWC project uses styles package to manage the global css tokens for all three themes. The styles package can be found in `tools/styles`. There is one very small caveat in the way we manage the styles package. We have two different tokens packages, one for the express + spectrum theme and one for the spectrum 2 theme.
44
+
45
+
-`styles/tokens` - This is the tokens package for the express + spectrum theme.
46
+
-`styles/tokens-v2` - This is the tokens package for the spectrum 2 theme.
47
+
48
+
NOTE: In all likelhood, you would only need to do minor changes to the styles package. However, if you feel like you need to make major changes to the styles package, the correct approach would be to start a discussion among the team and figure out a plan together.
49
+
50
+
### How to update the global styling
51
+
52
+
In our styles package, we have separation of vars for different contexts i.e, size and color.
53
+
54
+
#### Updating size-specific vars
55
+
56
+
If you're updating a size (e.g. `--spectrum-accordion-item-height`) variable, you'll need to update the `tools/styles/tokens/[express | spectrum]/[large | medium]-vars.css` file or the `tools/styles/tokens-v2/[large | medium]-vars.css` file depending on the theme.
57
+
58
+
#### Updating color-specific vars
59
+
60
+
If you're updating a color (e.g. `--spectrum-accordion-background-color`) variable, you'll need to update the `tools/styles/tokens/[express | spectrum]/[dark | light]-vars.css` file or the `tools/styles/tokens-v2/[dark | light]-vars.css` file depending on the theme.
61
+
62
+
NOTE: If the variable that you're updating is not present in those files, chances are that this variable had the same value for both contexts in that tokens package. In that case, if you want the variable to continue to have the same value then you can update the `tools/styles/[tokens | tokens-v2]/index.css` file.
63
+
Or if you want to make the variable context-specific, then you can add those new values in both of the files like we talked about above.
0 commit comments