Skip to content

Commit 228ee7f

Browse files
author
Melissa Thompson
authored
docs: update + centralize project docs (#2598)
In an effort to create a single source of truth for our documentation and make it easier for users to get started working with Spectrum CSS, this work: - Includes a Quick start guide in the readme, inspired by the tutorial that used to live in the docs site - Removes said tutorial from the docs site and links to the quick start guide in the readme instead - Removes contributing guidelines from the readme, which are replaced with a link to the contributing doc in github - Storybook contributing docs link to the more general contributing docs in github - General updates to readme language
1 parent 9c1d278 commit 228ee7f

File tree

5 files changed

+113
-151
lines changed

5 files changed

+113
-151
lines changed

.github/CONTRIBUTING.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ git push -u origin feat-my-awesome-new-feature
4747
git remote add upstream [email protected]:adobe/spectrum-css.git
4848
```
4949

50+
To ensure your Node environment is always aligned with the project, we strongly recommend using [nvm](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating). Once you have nvm installed, you can run:
51+
52+
```shell
53+
nvm use
54+
```
55+
56+
This will ensure the correct version of node is installed and used for the project. You always want to run nvm use when you first clone the project and whenever you switch branches.
57+
5058
Install [yarn](https://yarnpkg.com/en/docs/install):
5159

5260
```shell
@@ -59,6 +67,8 @@ Install dependencies:
5967
yarn install
6068
```
6169

70+
**Important:** Requires >= Node 18.8.1 and Yarn 1.22.0.
71+
6272
To generate a new component, run the generator:
6373

6474
```shell
@@ -71,13 +81,9 @@ To kick-off the project's storybook locally, run:
7181
yarn start
7282
```
7383

74-
This is our development environment, where you can see all the components in action, and develop new components. All components must have a storybook entry.
75-
76-
Working on the documentation site? Run:
84+
This is our development environment, where you can see all the components in action, and develop new components. All components must have a storybook entry. Edits to any of the `*.css`, `*.stories.js`, or `template.js` files in `components/*` will live reload in your browser. For more details about how to work within our Storybook setup, take a look at our [getting started Storybook guide](https://opensource.adobe.com/spectrum-css/preview/?path=/docs/guides-contributing--docs).
7785

78-
```shell
79-
yarn dev
80-
```
86+
This project is leveraging caching from [Nx](https://nx.dev/) to speed up the build process. If you are seeing unexpected results, you can clear the cache by running `yarn nx reset`.
8187

8288
Commit all changes with a [conventional commit message](https://www.conventionalcommits.org), making sure to correctly use `feat:`, `fix:`, and `BREAKING CHANGE` accordingly, and referencing the relevant issue number (if any):
8389

@@ -110,7 +116,7 @@ At this point you're waiting on us. We do our best to keep on top of all the pul
110116

111117
Some things that will increase the chance that your pull request is accepted:
112118

113-
- Write a thorough pull request description, include screenshots, and test your changes across all evergreen browsers.
119+
- Write a thorough pull request description, include screenshots, and test your changes across all [evergreen browsers](https://github.com/adobe/spectrum-css?tab=readme-ov-file#browser-support).
114120
- Write out your test cases for any new features or bug fixes in as much detail as possible and include them in the pull request description.
115121
- Make sure the PR merges cleanly with the latest main.
116122
- Describe your feature/bugfix and why it's needed/important in the pull request description.

.github/QUICK-START.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Quick start guide
2+
3+
This guide will show you how to quickly install Spectrum CSS and use it to display the Button component.
4+
5+
## Install using Node/yarn
6+
Install the components you want along with their dependencies. Here's an example:
7+
8+
```shell
9+
yarn add -DW @spectrum-css/tokens @spectrum-css/typography @spectrum-css/page @spectrum-css/icon @spectrum-css/button
10+
```
11+
12+
Spectrum CSS components utilize custom properties in order to change themes and scales. For these to apply, a couple of classes need to be added to the document’s `<html>` tag based on the [visual language](https://github.com/adobe/spectrum-css?tab=readme-ov-file#visual-language), [scale](https://github.com/adobe/spectrum-css?tab=readme-ov-file#scales), and [theme](https://github.com/adobe/spectrum-css?tab=readme-ov-file#themes-colorstops) you wish to use. For example, the following code snippet will display styling for the default Spectrum visual language using medium scale and light color theme:
13+
14+
```html
15+
<html class="spectrum spectrum--medium spectrum--light">
16+
```
17+
18+
Use the `index.css` files in your project to include component and global styles ([Spectrum and Express contexts](https://github.com/adobe/spectrum-css?tab=readme-ov-file#visual-language), [background theme/colorstop](https://github.com/adobe/spectrum-css?tab=readme-ov-file#themes-colorstops), [platform scaling](https://github.com/adobe/spectrum-css?tab=readme-ov-file#scales), etc.) for the component. If you don't need all of the global styles, peek at the docs for [including assets](https://github.com/adobe/spectrum-css?tab=readme-ov-file#including-assets)). Use this file by including the stylesheet (plus stylesheets for dependencies) in the `<head>` tag:
19+
20+
```html
21+
<head>
22+
<!-- Include global tokens depedency first -->
23+
<link rel="stylesheet" href="node_modules/@spectrum-css/tokens/dist/index.css"/>
24+
25+
<!-- Include index.css for the components you're using -->
26+
<link rel="stylesheet" href="node_modules/@spectrum-css/button/dist/index.css"/>
27+
</head>
28+
```
29+
30+
Inside the `<body>` tag, add the markup for your component (Spectrum button in our example). The example also includes the CSS class names `spectrum-Button--fill` and `spectrum-Button--accent`, to use the accent variant:
31+
32+
```html
33+
<button class="spectrum-Button spectrum-Button--fill spectrum-Button--accent spectrum-Button--sizeM">
34+
<span class="spectrum-Button-label">Button</span>
35+
</button>
36+
```
37+
38+
To put it all together, your final html file will look like this:
39+
40+
```html
41+
<html class="spectrum spectrum--light spectrum--medium">
42+
<head>
43+
<link rel="stylesheet" href="node_modules/@spectrum-css/tokens/dist/index.css"/>
44+
<link rel="stylesheet" href="node_modules/@spectrum-css/page/dist/index-vars.css">
45+
<link rel="stylesheet" href="node_modules/@spectrum-css/button/dist/index-vars.css">
46+
</head>
47+
<body>
48+
<button class="spectrum-Button spectrum-Button--fill spectrum-Button--accent spectrum-Button--sizeM">
49+
<span class="spectrum-Button-label">Button</span>
50+
</button>
51+
</body>
52+
</html>
53+
```
54+
55+
## Include files from a CDN
56+
Another way to include Spectrum CSS components in your project is to use a CDN to link to the components you want, plus their dependencies, in the `<head>` tag of your HTML. If you choose to use a CDN, please note that Spectrum CSS doesn't manage a CDN, cannot confirm the availability or up-time of external CDNs, and doesn't recommend using a CDN for Spectrum CSS in a production environment.

.storybook/guides/develop.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ Welcome to the development and exploration environment for Spectrum CSS, driven
1212

1313
## Table of contents
1414

15-
This guide is intended to help you get started contributing to the Spectrum CSS project. It will cover the following topics:
15+
This guide is intended to get you up to speed on how we work within Storybook in the Spectrum CSS project. It will cover the following topics:
1616

1717
- [Architecture](#architecture)
1818
- [Writing stories](#writing-stories)
1919
- [Templates](#templates)
2020
- [Testing stories](#testing-stories)
2121
- [Changelog](#changelog)
2222

23+
For more general information about how to contribute to the Spectrum CSS project, take a look at our [contribution guidelines on GitHub](https://github.com/adobe/spectrum-css/blob/main/.github/CONTRIBUTING.md).
24+
2325
## Prerequisites
2426

2527
- [Node.js](https://nodejs.org/en/) (v18 or later)

0 commit comments

Comments
 (0)