Skip to content

Commit a5bb2a3

Browse files
committed
chore: docs and smaller changes
1 parent 935e2be commit a5bb2a3

File tree

6 files changed

+106
-3
lines changed

6 files changed

+106
-3
lines changed

packages/storybook/.storybook/preview.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ export default definePreview({
5757
},
5858
options: {
5959
storySort: {
60-
order: ["Basics", "Jamboree26", ["Bottom Bar", "Bottom Bar Item"]],
60+
order: [
61+
"Home",
62+
"Setup – React",
63+
"Setup – Web Components",
64+
"Basics",
65+
"Jamboree26",
66+
["Bottom Bar", "Bottom Bar Item"],
67+
],
6168
},
6269
},
6370
},
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { Meta } from '@storybook/addon-docs/blocks';
2+
3+
<Meta title="Setup - React" />
4+
5+
# React setup guide
6+
7+
This guide will help you get started with using the Scouterna Design System React
8+
components in your React project.
9+
10+
## Install the packages
11+
12+
You need to install both the Web Components package and the React wrapper
13+
package. The Web Components package is listed as a peer dependency of the React
14+
wrapper package. The versions of both packages should always match to ensure
15+
compatibility:
16+
```bash
17+
pnpm install @scouterna/ui-webc @scouterna/ui-react
18+
```
19+
20+
## Usage
21+
22+
Before you can use the React components, you need to load the styles for the
23+
components. This only has to be done once, probably in your main entry file:
24+
```js
25+
import '@scouterna/ui-webc/style.css';
26+
```
27+
28+
Then you can start using the React components in your app:
29+
```js
30+
import { ScoutButton } from '@scouterna/ui-react';
31+
32+
function MyApp() {
33+
return (
34+
<ScoutButton
35+
variant="primary"
36+
onScoutClick={() => alert('Button clicked!')}
37+
>
38+
Click me
39+
</ScoutButton>
40+
);
41+
}
42+
```
43+
44+
## Design tokens
45+
46+
The design tokens can be consumed either via CSS variables or through the
47+
Tailwind theme. Which you choose depends on your project setup.
48+
49+
### CSS variables
50+
51+
If you wish to use the design token CSS variables, install the design tokens package:
52+
```bash
53+
pnpm install @scouterna/design-tokens
54+
```
55+
56+
Then import the CSS file somewhere in your project, probably in your main entry
57+
file:
58+
```js
59+
import '@scouterna/design-tokens/tokens.css';
60+
```
61+
62+
This will make the design token CSS variables available globally in your project.
63+
64+
### Tailwind theme
65+
66+
More info coming soon...

packages/storybook/src/welcome.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Meta } from '@storybook/addon-docs/blocks';
2+
3+
<Meta title="Home" />
4+
5+
# Scouterna Design System
6+
7+
Welcome to Scouterna's Design System for web applications. It's vaguely based on
8+
[our website](https://www.scouterna.se/)'s design with [our brand
9+
guidelines](https://www.scouterna.se/scout-ledare-kar/kommunicera/grafisk-profil/)
10+
in mind. However, we've also taken a lot of liberties to make it more suitable
11+
for application interfaces.
12+
13+
These components are developed and maintained by [Scouternas
14+
E-tjänster](https://etjanster.scout.se/).
15+
16+
## Flavors
17+
18+
We write our components as [Web
19+
Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) using
20+
[Stencil](https://stenciljs.com/). This means you can use them in any web
21+
application, regardless of framework. However, we also provide wrappers for
22+
React. If you need support for another framework that's [supported by
23+
Stencil](https://stenciljs.com/docs/overview), please [raise an
24+
issue](https://github.com/Scouterna/j26-web-components/issues).

packages/ui-react/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
"license": "UNLICENSED",
1818
"packageManager": "pnpm@10.7.0",
1919
"dependencies": {
20-
"@scouterna/ui-webc": "workspace:^",
2120
"@stencil/react-output-target": "^1.2.0"
2221
},
2322
"devDependencies": {
2423
"@types/react": "^19.2.5",
2524
"react": "^19.2.0",
2625
"react-dom": "^19.2.0",
2726
"typescript": "^5.9.3"
27+
},
28+
"peerDependencies": {
29+
"@scouterna/ui-webc": "workspace:*"
2830
}
2931
}

packages/ui-webc/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"import": "./dist/ui-webc/ui-webc.esm.js",
1515
"require": "./dist/ui-webc/ui-webc.cjs.js"
1616
},
17+
"./style.css": {
18+
"import": "./dist/ui-webc/ui-webc.css",
19+
"require": "./dist/ui-webc/ui-webc.css"
20+
},
1721
"./dist/*": {
1822
"import": "./dist/*",
1923
"types": "./dist/*"

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)