Skip to content

Commit bf3514f

Browse files
committed
Tutorial initialized
0 parents  commit bf3514f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+8984
-0
lines changed

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
.eslintcache
21+
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*

.storybook/main.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @type { import('@storybook/react-vite').StorybookConfig } */
2+
const config = {
3+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
4+
staticDirs: ["../public"],
5+
addons: [
6+
"@storybook/addon-links",
7+
"@storybook/addon-essentials",
8+
"@storybook/addon-interactions",
9+
],
10+
framework: {
11+
name: "@storybook/react-vite",
12+
options: {},
13+
},
14+
docs: {
15+
autodocs: "tag",
16+
},
17+
};
18+
export default config;

.storybook/preview.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** @type { import('@storybook/react').Preview } */
2+
const preview = {
3+
parameters: {
4+
actions: { argTypesRegex: "^on[A-Z].*" },
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/,
9+
},
10+
},
11+
},
12+
};
13+
14+
export default preview;

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Chroma Software Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<p align="center">
2+
<a href="https://www.chromatic.com/">
3+
<img alt="Chromatic" src="https://avatars2.githubusercontent.com/u/24584319?s=200&v=4" width="60" />
4+
</a>
5+
</p>
6+
7+
<h1 align="center">
8+
Chromatic's Intro to Storybook React template
9+
</h1>
10+
11+
This template ships with the main React and Storybook configuration files you'll need to get up and running fast.
12+
13+
## 🚅 Quick start
14+
15+
1. **Create the application.**
16+
17+
Use [degit](https://github.com/Rich-Harris/degit) to get this template.
18+
19+
```shell
20+
# Clone the template
21+
npx degit chromaui/intro-storybook-react-template taskbox
22+
```
23+
24+
1. **Install the dependencies.**
25+
26+
Navigate into your new site’s directory and install the necessary dependencies.
27+
28+
```shell
29+
# Navigate to the directory
30+
cd taskbox/
31+
32+
# Install the dependencies
33+
yarn
34+
```
35+
36+
1. **Open the source code and start editing!**
37+
38+
Open the `taskbox` directory in your code editor of choice and building your first component!
39+
40+
1. **Browse your stories!**
41+
42+
Run `yarn storybook` to see your component's stories at `http://localhost:6006`
43+
44+
## 🔎 What's inside?
45+
46+
A quick look at the top-level files and directories included with this template.
47+
48+
.
49+
├── .storybook
50+
├── node_modules
51+
├── public
52+
├── src
53+
├── .gitignore
54+
├── .index.html
55+
├── LICENSE
56+
├── package.json
57+
├── yarn.lock
58+
├── vite.config.js
59+
└── README.md
60+
61+
1. **`.storybook`**: This directory contains Storybook's [configuration](https://storybook.js.org/docs/react/configure/overview) files.
62+
63+
2. **`node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages).
64+
65+
3. **`public`**: This directory will contain the development and production build of the site.
66+
67+
4. **`src`**: This directory will contain all of the code related to what you will see on your application.
68+
69+
5. **`.gitignore`**: This file tells git which files it should not track or maintain during the development process of your project.
70+
71+
6. **`.index.html`**: This is the HTML page that is served when generating a development or production build.
72+
73+
7. **`LICENSE`**: The template is licensed under the MIT licence.
74+
75+
8. **`package.json`**: Standard manifest file for Node.js projects, which typically includes project specific metadata (such as the project's name, the author among other information). It's based on this file that npm will know which packages are necessary to the project.
76+
77+
9. **`yarn.lock`**: This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(Do not change it manually).**
78+
79+
10. **`vite.config.js`**: This is the configuration file for [Vite](https://vitejs.dev/), a build tool that aims to provide a faster and leaner development experience for modern web projects.
80+
81+
11. **`README.md`**: A text file containing useful reference information about the project.
82+
83+
## Contribute
84+
85+
If you encounter an issue with the template, we encourage you to open an issue in this template's repository.
86+
87+
## Learning Storybook
88+
89+
1. Read our introductory tutorial at [Learn Storybook](https://storybook.js.org/tutorials/intro-to-storybook/react/en/get-started/).
90+
2. Learn how to transform your component libraries into design systems in our [Design Systems for Developers](https://storybook.js.org/tutorials/design-systems-for-developers/) tutorial.
91+
3. See our official documentation at [Storybook](https://storybook.js.org/).

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

package.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "intro-storybook-react-template",
3+
"version": "0.2.0",
4+
"description": "Starter template to get up and running quickly with React and Storybook",
5+
"author": "Chromatic <https://chromatic.com/>",
6+
"type": "module",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/chromaui/intro-storybook-react-template"
10+
},
11+
"bugs": {
12+
"url": "https://github.com/chromaui/intro-storybook-react-template/issues"
13+
},
14+
"license": "MIT",
15+
"private": true,
16+
"dependencies": {
17+
"react": "^18.2.0",
18+
"react-dom": "^18.2.0"
19+
},
20+
"scripts": {
21+
"dev": "vite",
22+
"build": "vite build",
23+
"preview": "vite preview",
24+
"storybook": "storybook dev -p 6006",
25+
"build-storybook": "storybook build",
26+
"init-msw": "msw init public/"
27+
},
28+
"devDependencies": {
29+
"@storybook/addon-essentials": "^7.6.6",
30+
"@storybook/addon-interactions": "^7.6.6",
31+
"@storybook/addon-links": "^7.6.6",
32+
"@storybook/blocks": "^7.6.6",
33+
"@storybook/react": "^7.6.6",
34+
"@storybook/react-vite": "^7.6.6",
35+
"@storybook/test": "^7.6.6",
36+
"@types/react": "^18.0.28",
37+
"@types/react-dom": "^18.0.11",
38+
"@vitejs/plugin-react": "^3.1.0",
39+
"msw": "^1.2.1",
40+
"msw-storybook-addon": "^1.10.0",
41+
"prop-types": "^15.8.1",
42+
"storybook": "^7.6.6",
43+
"vite": "^4.2.0"
44+
},
45+
"resolutions": {
46+
"jackspeak": "2.1.1"
47+
}
48+
}

public/vite.svg

Lines changed: 1 addition & 0 deletions
Loading

src/App.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}
7+
8+
.logo {
9+
height: 6em;
10+
padding: 1.5em;
11+
will-change: filter;
12+
transition: filter 300ms;
13+
}
14+
.logo:hover {
15+
filter: drop-shadow(0 0 2em #646cffaa);
16+
}
17+
.logo.react:hover {
18+
filter: drop-shadow(0 0 2em #61dafbaa);
19+
}
20+
21+
@keyframes logo-spin {
22+
from {
23+
transform: rotate(0deg);
24+
}
25+
to {
26+
transform: rotate(360deg);
27+
}
28+
}
29+
30+
@media (prefers-reduced-motion: no-preference) {
31+
a:nth-of-type(2) .logo {
32+
animation: logo-spin infinite 20s linear;
33+
}
34+
}
35+
36+
.card {
37+
padding: 2em;
38+
}
39+
40+
.read-the-docs {
41+
color: #888;
42+
}

src/App.jsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { useState } from 'react'
2+
import reactLogo from './assets/react.svg'
3+
import viteLogo from '/vite.svg'
4+
import './App.css'
5+
6+
function App() {
7+
const [count, setCount] = useState(0)
8+
9+
return (
10+
<div className="App">
11+
<div>
12+
<a href="https://vitejs.dev" target="_blank">
13+
<img src={viteLogo} className="logo" alt="Vite logo" />
14+
</a>
15+
<a href="https://reactjs.org" target="_blank">
16+
<img src={reactLogo} className="logo react" alt="React logo" />
17+
</a>
18+
</div>
19+
<h1>Vite + React</h1>
20+
<div className="card">
21+
<button onClick={() => setCount((count) => count + 1)}>
22+
count is {count}
23+
</button>
24+
<p>
25+
Edit <code>src/App.jsx</code> and save to test HMR
26+
</p>
27+
</div>
28+
<p className="read-the-docs">
29+
Click on the Vite and React logos to learn more
30+
</p>
31+
</div>
32+
)
33+
}
34+
35+
export default App

0 commit comments

Comments
 (0)