@asantemedia-org/atlas-copco-vt-storybook 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +3 -0
- package/.nvmrc +1 -0
- package/.prettierignore +2 -0
- package/.prettierrc +8 -0
- package/.storybook/AtlasCopcoTheme.ts +14 -0
- package/.storybook/global.scss +15 -0
- package/.storybook/main.ts +125 -0
- package/.storybook/manager.ts +6 -0
- package/.storybook/preview-head.html +4 -0
- package/.storybook/preview.tsx +73 -0
- package/.storybook/types.d.ts +5 -0
- package/.vscode/settings.json +4 -0
- package/README.md +59 -0
- package/next.config.js +8 -0
- package/package.json +76 -0
- package/postcss.config.js +6 -0
- package/public/.gitkeep +0 -0
- package/public/assets/.gitkeep +0 -0
- package/public/fonts/.gitkeep +0 -0
- package/src/app/globals.css +13 -0
- package/src/app/layout.tsx +18 -0
- package/src/app/page.tsx +11 -0
- package/src/components/Button/Button.module.scss +77 -0
- package/src/components/Button/Button.stories.tsx +97 -0
- package/src/components/Button/Button.tsx +47 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Image/Image.module.scss +75 -0
- package/src/components/Image/Image.tsx +114 -0
- package/src/components/Image/Image.types.ts +34 -0
- package/src/components/Image/index.ts +2 -0
- package/src/components/ProductCardDetails/ProductCardDetails.module.scss +129 -0
- package/src/components/ProductCardDetails/ProductCardDetails.stories.tsx +138 -0
- package/src/components/ProductCardDetails/ProductCardDetails.tsx +61 -0
- package/src/components/ProductCardDetails/index.ts +2 -0
- package/src/components/ProductCardHorizontal/ProductCardHorizontal.module.scss +93 -0
- package/src/components/ProductCardHorizontal/ProductCardHorizontal.stories.tsx +72 -0
- package/src/components/ProductCardHorizontal/ProductCardHorizontal.tsx +50 -0
- package/src/components/ProductCardHorizontal/index.ts +2 -0
- package/src/experience/algolia-dynamic-search/AlgoliaDynamicSearch.scss +135 -0
- package/src/experience/algolia-dynamic-search/AlgoliaDynamicSearch.stories.tsx +109 -0
- package/src/experience/algolia-dynamic-search/AlgoliaDynamicSearch.tsx +67 -0
- package/src/experience/algolia-dynamic-search/index.ts +2 -0
- package/src/experience/qr-form-journey/QrFormJourney.scss +37 -0
- package/src/experience/qr-form-journey/QrFormJourney.stories.tsx +134 -0
- package/src/experience/qr-form-journey/QrFormJourney.tsx +69 -0
- package/src/experience/qr-form-journey/index.ts +2 -0
- package/src/index.ts +19 -0
- package/src/stories/foundation/_components/StoryLayout.tsx +67 -0
- package/src/stories/introduction/Welcome.mdx +36 -0
- package/src/types/buttons.ts +4 -0
- package/src/types/cards.ts +37 -0
- package/src/utils/data/algolia-dynamic-widget-product-data.json +46 -0
- package/src/utils/styles/base.scss +100 -0
- package/src/utils/styles/global.scss +29 -0
- package/src/utils/styles/index.ts +1 -0
- package/src/utils/styles/typography.scss +60 -0
- package/tailwind.config.js +19 -0
- package/tsconfig.json +41 -0
- package/types/@asantemedia-org__edwardsvacuum-design-system.d.ts +8 -0
package/.eslintrc.json
ADDED
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
21.6.1
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { create } from "@storybook/theming/create";
|
|
2
|
+
|
|
3
|
+
export default create({
|
|
4
|
+
base: "light",
|
|
5
|
+
appBg: "white",
|
|
6
|
+
appContentBg: "white",
|
|
7
|
+
appBorderColor: "#c5c7c4",
|
|
8
|
+
appBorderRadius: 4,
|
|
9
|
+
brandTitle: "Atlas Copco VT - Design System",
|
|
10
|
+
brandUrl: "https://www.atlascopco.com/",
|
|
11
|
+
brandImage:
|
|
12
|
+
"https://www.atlascopco.com/etc.clientlibs/settings/wcm/designs/accommons/design-system/clientlib-assets/resources/icons/logo.svg",
|
|
13
|
+
brandTarget: "_self",
|
|
14
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* Global CSS for Atlas Copco VTBA Design System */
|
|
2
|
+
@use "../src/utils/styles/global" as *;
|
|
3
|
+
@use "../src/utils/styles/base.scss" as *;
|
|
4
|
+
@use "../src/utils/styles/typography.scss";
|
|
5
|
+
|
|
6
|
+
.sidebar-item {
|
|
7
|
+
svg {
|
|
8
|
+
display: none !important;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.sbdocs.sbdocs-wrapper {
|
|
13
|
+
padding-top: 0;
|
|
14
|
+
padding-bottom: 0;
|
|
15
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/nextjs";
|
|
2
|
+
import type { RuleSetRule } from "webpack";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const isCssLoader = (loaderPath: string): boolean => {
|
|
6
|
+
return loaderPath.includes("css-loader") && !loaderPath.includes("postcss-loader");
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const updateCssLoaderOptions = (loaders: unknown[]): unknown[] => {
|
|
10
|
+
return loaders.map((loader) => {
|
|
11
|
+
if (
|
|
12
|
+
loader &&
|
|
13
|
+
typeof loader === "object" &&
|
|
14
|
+
"loader" in loader &&
|
|
15
|
+
typeof (loader as { loader?: string }).loader === "string" &&
|
|
16
|
+
isCssLoader((loader as { loader: string }).loader)
|
|
17
|
+
) {
|
|
18
|
+
const loaderObj = loader as { loader: string; options?: Record<string, unknown> };
|
|
19
|
+
const existingModules = loaderObj.options?.modules;
|
|
20
|
+
return {
|
|
21
|
+
...loaderObj,
|
|
22
|
+
options: {
|
|
23
|
+
...loaderObj.options,
|
|
24
|
+
modules:
|
|
25
|
+
typeof existingModules === "object" && existingModules !== null
|
|
26
|
+
? {
|
|
27
|
+
...existingModules,
|
|
28
|
+
localIdentName: "[name]__[local]___[hash:base64:5]",
|
|
29
|
+
}
|
|
30
|
+
: {
|
|
31
|
+
auto: (resourcePath: string) => resourcePath.endsWith(".module.scss"),
|
|
32
|
+
localIdentName: "[name]__[local]___[hash:base64:5]",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return loader;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const config: StorybookConfig = {
|
|
42
|
+
core: {
|
|
43
|
+
builder: "@storybook/builder-webpack5",
|
|
44
|
+
},
|
|
45
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
46
|
+
staticDirs: ["../public"],
|
|
47
|
+
addons: [
|
|
48
|
+
"@storybook/addon-links",
|
|
49
|
+
"@storybook/addon-essentials",
|
|
50
|
+
"@storybook/addon-interactions",
|
|
51
|
+
"storybook-addon-pseudo-states",
|
|
52
|
+
"@storybook/addon-storysource",
|
|
53
|
+
"@storybook/addon-a11y",
|
|
54
|
+
"@whitespace/storybook-addon-html",
|
|
55
|
+
{
|
|
56
|
+
name: "@storybook/addon-styling",
|
|
57
|
+
options: {
|
|
58
|
+
postCss: true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
framework: {
|
|
63
|
+
name: "@storybook/nextjs",
|
|
64
|
+
options: {},
|
|
65
|
+
},
|
|
66
|
+
docs: {
|
|
67
|
+
autodocs: "tag",
|
|
68
|
+
},
|
|
69
|
+
env: {
|
|
70
|
+
STORYBOOK: "true",
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
webpackFinal: async (config) => {
|
|
74
|
+
config.module = config.module || { rules: [] };
|
|
75
|
+
config.resolve = config.resolve || {};
|
|
76
|
+
|
|
77
|
+
const processRule = (rule: RuleSetRule): RuleSetRule => {
|
|
78
|
+
if (rule.oneOf) {
|
|
79
|
+
rule.oneOf = rule.oneOf.map((oneOfRule) => {
|
|
80
|
+
if (oneOfRule && typeof oneOfRule === "object" && "use" in oneOfRule) {
|
|
81
|
+
const r = oneOfRule as RuleSetRule;
|
|
82
|
+
if (r.use && Array.isArray(r.use)) {
|
|
83
|
+
r.use = updateCssLoaderOptions(r.use) as RuleSetRule["use"];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return oneOfRule;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (rule.use && Array.isArray(rule.use)) {
|
|
90
|
+
rule.use = updateCssLoaderOptions(rule.use) as RuleSetRule["use"];
|
|
91
|
+
}
|
|
92
|
+
return rule;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
config.module.rules = config.module.rules?.map((rule) => {
|
|
96
|
+
if (rule && typeof rule === "object" && "test" in rule) {
|
|
97
|
+
return processRule(rule as RuleSetRule);
|
|
98
|
+
}
|
|
99
|
+
return rule;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Edwards design system expects FontAwesome Pro; alias to free icons so build works without Pro license
|
|
103
|
+
config.resolve.alias = {
|
|
104
|
+
...config.resolve.alias,
|
|
105
|
+
"@fonts": path.resolve(__dirname, "../public/fonts"),
|
|
106
|
+
"@fortawesome/pro-solid-svg-icons": path.resolve(
|
|
107
|
+
__dirname,
|
|
108
|
+
"../node_modules/@fortawesome/free-solid-svg-icons"
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
config.module?.rules?.push({
|
|
113
|
+
test: /\.(ttf|woff|woff2|eot|otf)$/i,
|
|
114
|
+
type: "asset/resource",
|
|
115
|
+
generator: {
|
|
116
|
+
filename: "fonts/[name][ext]",
|
|
117
|
+
},
|
|
118
|
+
include: path.resolve(__dirname, "../public/fonts"),
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return config;
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default config;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<!-- .storybook/preview-head.html -->
|
|
2
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
3
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
4
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Preview } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Title, Subtitle, Description, Primary, Controls, Stories } from "@storybook/blocks";
|
|
4
|
+
|
|
5
|
+
import "./global.scss";
|
|
6
|
+
|
|
7
|
+
const ATLAS_COPCO_VIEWPORTS = {
|
|
8
|
+
xs: {
|
|
9
|
+
name: "Extra Small",
|
|
10
|
+
styles: { width: "375px", height: "667px" },
|
|
11
|
+
},
|
|
12
|
+
sm: {
|
|
13
|
+
name: "Small",
|
|
14
|
+
styles: { width: "768px", height: "1024px" },
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
name: "Medium",
|
|
18
|
+
styles: { width: "992px", height: "1024px" },
|
|
19
|
+
},
|
|
20
|
+
lg: {
|
|
21
|
+
name: "Large",
|
|
22
|
+
styles: { width: "1024px", height: "1024px" },
|
|
23
|
+
},
|
|
24
|
+
xl: {
|
|
25
|
+
name: "Extra Large",
|
|
26
|
+
styles: { width: "1440px", height: "1024px" },
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const preview: Preview = {
|
|
31
|
+
parameters: {
|
|
32
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
33
|
+
controls: {
|
|
34
|
+
matchers: {
|
|
35
|
+
color: /(background|color)$/i,
|
|
36
|
+
date: /Date$/,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
viewport: {
|
|
40
|
+
viewports: ATLAS_COPCO_VIEWPORTS,
|
|
41
|
+
},
|
|
42
|
+
docs: {
|
|
43
|
+
page: () => (
|
|
44
|
+
<>
|
|
45
|
+
<Title />
|
|
46
|
+
<Subtitle />
|
|
47
|
+
<Description />
|
|
48
|
+
<Primary />
|
|
49
|
+
<Controls />
|
|
50
|
+
<Stories />
|
|
51
|
+
</>
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
options: {
|
|
55
|
+
storySort: {
|
|
56
|
+
order: [
|
|
57
|
+
"Introduction",
|
|
58
|
+
["Welcome", "About Design System", "Designers Guide"],
|
|
59
|
+
"Foundation",
|
|
60
|
+
["Colours", "Icons", "Spacing", "Layout"],
|
|
61
|
+
"Typography",
|
|
62
|
+
["Typography", "Typography Styles"],
|
|
63
|
+
"Atoms",
|
|
64
|
+
"Components",
|
|
65
|
+
"Experiences",
|
|
66
|
+
"Templates",
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default preview;
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Atlas Copco VTBA – Storybook
|
|
2
|
+
|
|
3
|
+
Storybook-based design system for Atlas Copco VTBA, bootstrapped from the Leybold Storybook boilerplate.
|
|
4
|
+
|
|
5
|
+
## Tech stack
|
|
6
|
+
|
|
7
|
+
- **React 18** + **TypeScript**
|
|
8
|
+
- **Storybook 7** with `@storybook/nextjs`
|
|
9
|
+
- **SCSS modules** + **Tailwind CSS** + **PostCSS**
|
|
10
|
+
- **Next.js 13** (App Router) for optional dev app
|
|
11
|
+
|
|
12
|
+
## Getting started
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Install dependencies
|
|
16
|
+
npm install
|
|
17
|
+
|
|
18
|
+
# Run Storybook (default: http://localhost:6006)
|
|
19
|
+
npm run storybook
|
|
20
|
+
|
|
21
|
+
# Build static Storybook
|
|
22
|
+
npm run build-storybook
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Scripts
|
|
26
|
+
|
|
27
|
+
| Script | Description |
|
|
28
|
+
|---------------------|--------------------------------|
|
|
29
|
+
| `npm run storybook` | Start Storybook dev server |
|
|
30
|
+
| `npm run build-storybook` | Build static Storybook |
|
|
31
|
+
| `npm run dev` | Start Next.js dev server |
|
|
32
|
+
| `npm run build` | Build Next.js app |
|
|
33
|
+
| `npm run lint` | Run ESLint |
|
|
34
|
+
|
|
35
|
+
## Project structure
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
.storybook/ # Storybook config, theme, preview
|
|
39
|
+
src/
|
|
40
|
+
app/ # Next.js App Router (optional)
|
|
41
|
+
components/ # React components + *.stories.tsx
|
|
42
|
+
stories/ # Introduction & foundation MDX
|
|
43
|
+
utils/styles/ # Design tokens, base, typography
|
|
44
|
+
public/ # Static assets
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Adding components
|
|
48
|
+
|
|
49
|
+
1. Add a component under `src/components/<Name>/` (e.g. `Button.tsx`, `Button.module.scss`).
|
|
50
|
+
2. Add `*.stories.tsx` in the same folder or in `src/stories/`.
|
|
51
|
+
3. Use design tokens from `src/utils/styles/base.scss` (e.g. `--atlascopco-blue`).
|
|
52
|
+
|
|
53
|
+
## Design tokens
|
|
54
|
+
|
|
55
|
+
- **Primary:** `--atlascopco-blue` (#0062b0)
|
|
56
|
+
- **Greys:** `--atlascopco-grey-100` … `--atlascopco-grey-600`
|
|
57
|
+
- **Typography:** `--font-family-base` (Inter), heading/body CSS vars in `base.scss`
|
|
58
|
+
|
|
59
|
+
Customize tokens in `src/utils/styles/base.scss` and reuse in components.
|
package/next.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@asantemedia-org/atlas-copco-vt-storybook",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Atlas Copco VT Design System - Storybook",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "next dev",
|
|
11
|
+
"build": "next build",
|
|
12
|
+
"start": "next start",
|
|
13
|
+
"lint": "next lint",
|
|
14
|
+
"storybook": "storybook dev -p 6006",
|
|
15
|
+
"build-storybook": "storybook build"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"classnames": "^2.5.1",
|
|
19
|
+
"next": "13.3.0",
|
|
20
|
+
"react": "18.2.0",
|
|
21
|
+
"react-dom": "18.2.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@asantemedia-org/edwardsvacuum-design-system": "^1.6.69",
|
|
25
|
+
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
|
26
|
+
"@fortawesome/free-solid-svg-icons": "~6.7.2",
|
|
27
|
+
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
28
|
+
"@babel/preset-react": "^7.26.3",
|
|
29
|
+
"@storybook/addon-a11y": "7.6.21",
|
|
30
|
+
"@storybook/addon-essentials": "7.6.21",
|
|
31
|
+
"@storybook/addon-interactions": "7.6.21",
|
|
32
|
+
"@storybook/addon-links": "7.6.21",
|
|
33
|
+
"@storybook/addon-storysource": "7.6.21",
|
|
34
|
+
"@storybook/addon-styling": "1.0.1",
|
|
35
|
+
"@storybook/blocks": "7.6.21",
|
|
36
|
+
"@storybook/nextjs": "7.6.21",
|
|
37
|
+
"@storybook/react": "7.6.21",
|
|
38
|
+
"@storybook/testing-library": "0.0.14-next.2",
|
|
39
|
+
"@testing-library/dom": "^10.4.0",
|
|
40
|
+
"@testing-library/react": "^16.2.0",
|
|
41
|
+
"@types/node": "18.15.11",
|
|
42
|
+
"@types/react": "18.0.35",
|
|
43
|
+
"@types/react-dom": "18.0.11",
|
|
44
|
+
"@whitespace/storybook-addon-html": "^5.1.6",
|
|
45
|
+
"autoprefixer": "10.4.14",
|
|
46
|
+
"css-loader": "^7.1.2",
|
|
47
|
+
"eslint": ">=6.8.0",
|
|
48
|
+
"eslint-config-next": "13.3.0",
|
|
49
|
+
"eslint-plugin-storybook": "^0.6.11",
|
|
50
|
+
"postcss": "8.4.31",
|
|
51
|
+
"postcss-loader": "^7.3.4",
|
|
52
|
+
"prettier": "^2.8.8",
|
|
53
|
+
"raw-loader": "^4.0.2",
|
|
54
|
+
"sass": "^1.85.0",
|
|
55
|
+
"sass-loader": "^16.0.5",
|
|
56
|
+
"storybook": "7.6.21",
|
|
57
|
+
"storybook-addon-pseudo-states": "~2.0.2",
|
|
58
|
+
"style-loader": "^4.0.0",
|
|
59
|
+
"tailwindcss": "3.3.1",
|
|
60
|
+
"typescript": "5.0.4"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"react": ">=18.2.0",
|
|
64
|
+
"react-dom": ">=18.2.0"
|
|
65
|
+
},
|
|
66
|
+
"main": "next.config.js",
|
|
67
|
+
"repository": {
|
|
68
|
+
"type": "git",
|
|
69
|
+
"url": "git+https://github.com/AsanteMediaServices/atlascopco-vt-storybook.git"
|
|
70
|
+
},
|
|
71
|
+
"author": "Bernard Asante",
|
|
72
|
+
"bugs": {
|
|
73
|
+
"url": "https://github.com/AsanteMediaServices/atlascopco-vt-storybook/issues"
|
|
74
|
+
},
|
|
75
|
+
"homepage": "https://github.com/AsanteMediaServices/atlascopco-vt-storybook#readme"
|
|
76
|
+
}
|
package/public/.gitkeep
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./globals.css";
|
|
2
|
+
|
|
3
|
+
export const metadata = {
|
|
4
|
+
title: "Atlas Copco VTBA Design System",
|
|
5
|
+
description: "Design system for Atlas Copco VTBA",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default function RootLayout({
|
|
9
|
+
children,
|
|
10
|
+
}: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<body>{children}</body>
|
|
16
|
+
</html>
|
|
17
|
+
);
|
|
18
|
+
}
|
package/src/app/page.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function Home() {
|
|
2
|
+
return (
|
|
3
|
+
<main style={{ padding: "2rem" }}>
|
|
4
|
+
<h1>Atlas Copco VTBA Design System</h1>
|
|
5
|
+
<p>Welcome to the Atlas Copco VTBA Design System development environment.</p>
|
|
6
|
+
<p>
|
|
7
|
+
Run <code>npm run storybook</code> to view the component library.
|
|
8
|
+
</p>
|
|
9
|
+
</main>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@use "../../utils/styles/base.scss" as *;
|
|
2
|
+
|
|
3
|
+
.button {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
gap: $spacing-sm;
|
|
8
|
+
font-family: $font-family-base;
|
|
9
|
+
font-weight: 500;
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
text-align: center;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
user-select: none;
|
|
14
|
+
border: 2px solid transparent;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
transition: all 0.2s ease-in-out;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
|
|
19
|
+
&:focus-visible {
|
|
20
|
+
outline: 2px solid $atlascopco-black;
|
|
21
|
+
outline-offset: 2px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&--primary {
|
|
25
|
+
color: $atlascopco-white;
|
|
26
|
+
background-color: $atlascopco-blue;
|
|
27
|
+
border-color: $atlascopco-blue;
|
|
28
|
+
|
|
29
|
+
&:hover:not(.button--disabled) {
|
|
30
|
+
background-color: $atlascopco-blue-dark;
|
|
31
|
+
border-color: $atlascopco-blue-dark;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&--secondary {
|
|
36
|
+
color: $atlascopco-blue;
|
|
37
|
+
background-color: transparent;
|
|
38
|
+
border-color: $atlascopco-blue;
|
|
39
|
+
|
|
40
|
+
&:hover:not(.button--disabled) {
|
|
41
|
+
color: $atlascopco-white;
|
|
42
|
+
background-color: $atlascopco-blue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--outlined {
|
|
47
|
+
color: $atlascopco-grey-500;
|
|
48
|
+
background-color: transparent;
|
|
49
|
+
border-color: $atlascopco-grey-300;
|
|
50
|
+
|
|
51
|
+
&:hover:not(.button--disabled) {
|
|
52
|
+
border-color: $atlascopco-blue;
|
|
53
|
+
color: $atlascopco-blue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--small {
|
|
58
|
+
padding: $spacing-xs $spacing-sm;
|
|
59
|
+
font-size: 0.75rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&--medium {
|
|
63
|
+
padding: $spacing-sm $spacing-md;
|
|
64
|
+
font-size: 0.875rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&--large {
|
|
68
|
+
padding: $spacing-md $spacing-lg;
|
|
69
|
+
font-size: 1rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--disabled {
|
|
73
|
+
opacity: 0.5;
|
|
74
|
+
cursor: not-allowed;
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Button } from "./Button";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Button> = {
|
|
6
|
+
title: "Components/Button",
|
|
7
|
+
component: Button,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: "Primary action button with Atlas Copco VTBA variants and sizes.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
variant: {
|
|
19
|
+
control: "select",
|
|
20
|
+
options: ["primary", "secondary", "outlined"],
|
|
21
|
+
description: "Visual variant",
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
control: "select",
|
|
25
|
+
options: ["small", "medium", "large"],
|
|
26
|
+
description: "Button size",
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
control: "boolean",
|
|
30
|
+
description: "Disabled state",
|
|
31
|
+
},
|
|
32
|
+
onClick: {
|
|
33
|
+
action: "clicked",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default meta;
|
|
39
|
+
type Story = StoryObj<typeof Button>;
|
|
40
|
+
|
|
41
|
+
export const Primary: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
children: "Primary action",
|
|
44
|
+
variant: "primary",
|
|
45
|
+
size: "medium",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Secondary: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
children: "Secondary",
|
|
52
|
+
variant: "secondary",
|
|
53
|
+
size: "medium",
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Outlined: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
children: "Outlined",
|
|
60
|
+
variant: "outlined",
|
|
61
|
+
size: "medium",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const Small: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
children: "Small",
|
|
68
|
+
variant: "primary",
|
|
69
|
+
size: "small",
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const Large: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
children: "Large",
|
|
76
|
+
variant: "primary",
|
|
77
|
+
size: "large",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Disabled: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
children: "Disabled",
|
|
84
|
+
variant: "primary",
|
|
85
|
+
disabled: true,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const AllVariants: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<div style={{ display: "flex", gap: "1rem", flexWrap: "wrap" }}>
|
|
92
|
+
<Button variant="primary">Primary</Button>
|
|
93
|
+
<Button variant="secondary">Secondary</Button>
|
|
94
|
+
<Button variant="outlined">Outlined</Button>
|
|
95
|
+
</div>
|
|
96
|
+
),
|
|
97
|
+
};
|