Skip to content

Commit 6b9ff97

Browse files
committed
Tutorial initialized
0 parents  commit 6b9ff97

34 files changed

+9737
-0
lines changed

.eslintrc.cjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2020: true
5+
},
6+
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:react-hooks/recommended', 'plugin:storybook/recommended'],
7+
parserOptions: {
8+
ecmaVersion: 'latest',
9+
sourceType: 'module'
10+
},
11+
settings: {
12+
react: {
13+
version: '18.2'
14+
}
15+
},
16+
plugins: ['react-refresh'],
17+
rules: {
18+
'react-refresh/only-export-components': 'warn'
19+
}
20+
};

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

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

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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 UI Testing Handbook 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/ui-testing-handbook-react-template ui-testing-guide-code
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 ui-testing-guide-code/
31+
32+
# Install the dependencies
33+
yarn
34+
```
35+
36+
1. **Open the source code and start editing!**
37+
38+
Open the `ui-testing-guide-code` 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+
├── package.json
56+
├── yarn.lock
57+
├── vite.config.js
58+
└── README.md
59+
60+
1. **`.storybook`**: This directory contains Storybook's [configuration](https://storybook.js.org/docs/react/configure/overview) files.
61+
62+
2. **`node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages).
63+
64+
3. **`public`**: This directory will contain the development and production build of the site.
65+
66+
4. **`src`**: This directory will contain all of the code related to what you will see on your application.
67+
68+
5. **`.gitignore`**: This file tells git which files it should not track or maintain during the development process of your project.
69+
70+
6. **`.index.html`**: This is the HTML page that is served when generating a development or production build.
71+
72+
7. **`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.
73+
74+
8. **`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).**
75+
76+
9. **`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.
77+
78+
10. **`README.md`**: A text file containing useful reference information about the project.
79+
80+
## Contribute
81+
82+
If you encounter an issue with the template, we encourage you to open an issue in this template's repository.
83+
84+
## Learning Storybook
85+
86+
1. Read our introductory tutorial at [Learn Storybook](https://storybook.js.org/tutorials/intro-to-storybook/react/en/get-started/).
87+
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.
88+
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>Taskbox</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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "testing-ui-code-vite-sb-7",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vite build",
9+
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
10+
"preview": "vite preview",
11+
"storybook": "storybook dev -p 6006",
12+
"build-storybook": "storybook build",
13+
"init-msw": "msw init public/"
14+
},
15+
"dependencies": {
16+
"react": "^18.2.0",
17+
"react-dom": "^18.2.0"
18+
},
19+
"devDependencies": {
20+
"@storybook/addon-essentials": "^7.6.6",
21+
"@storybook/addon-interactions": "^7.6.6",
22+
"@storybook/addon-links": "^7.6.6",
23+
"@storybook/blocks": "^7.6.6",
24+
"@storybook/react": "^7.6.6",
25+
"@storybook/react-vite": "^7.6.6",
26+
"@storybook/test": "^7.6.5",
27+
"@types/react": "^18.0.28",
28+
"@types/react-dom": "^18.0.11",
29+
"@vitejs/plugin-react": "^4.0.0",
30+
"msw": "^1.2.1",
31+
"msw-storybook-addon": "^1.10.0",
32+
"eslint": "^8.38.0",
33+
"eslint-plugin-react": "^7.32.2",
34+
"eslint-plugin-react-hooks": "^4.6.0",
35+
"eslint-plugin-react-refresh": "^0.3.4",
36+
"eslint-plugin-storybook": "^0.6.15",
37+
"prop-types": "^15.8.1",
38+
"storybook": "^7.6.6",
39+
"vite": "^4.3.2"
40+
},
41+
"resolutions": {
42+
"jackspeak": "2.1.1"
43+
}
44+
}

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useAuth } from "./useAuth";
2+
import InboxScreen from "./InboxScreen";
3+
import LoginScreen from "./LoginScreen";
4+
import "./index.css";
5+
function App() {
6+
const [user, logIn] = useAuth();
7+
8+
return <>{user?.token ? <InboxScreen /> : <LoginScreen onLogIn={logIn} />}</>;
9+
}
10+
11+
export default App;

0 commit comments

Comments
 (0)