mainstack-design-system 0.0.2 → 0.0.4
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/README.md +26 -82
- package/package.json +2 -2
- package/src/components/InputFields/MarkdownEditor.tsx +3 -1
- package/src/components/index.ts +33 -0
- package/src/index.ts +4 -0
- package/src/pages/Home.tsx +1 -1
- package/vite.config.ts +4 -0
package/README.md
CHANGED
|
@@ -8,37 +8,47 @@ This is a component library for the Mainstack Design System. It is built with Re
|
|
|
8
8
|
|
|
9
9
|
To view the design system documentation, visit this [link](https://mainstack-design-system.vercel.app/).
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
# Usage
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Components
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Components can be used by importing from the `src/components` directory. For example:
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
`import { Button } from 'mainstack-design-system/src/components/Buttons';`
|
|
18
|
+
|
|
19
|
+
## Icons
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
Icons are imported from the `src/icons` directory. For example:
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
`import { ArrowRight } from 'mainstack-design-system/src/icons';`
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
## Colors
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
Colors are imported from the `mainstack-design-system/src/components/styleGuide` directory. For example:
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
```
|
|
30
|
+
import Colors from "mainstack-design-system/components/styleGuide/Colors";
|
|
31
|
+
|
|
32
|
+
<Text color={Colors.black300}>Hello World</Text>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Conventional Commits is a specification for adding human and machine readable meaning to commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with [SemVer](https://semver.org), by describing the features, fixes, and breaking changes made in commit messages.
|
|
36
|
+
[more info](https://www.conventionalcommits.org/en/v1.0.0/)
|
|
37
|
+
|
|
38
|
+
## Contributing
|
|
29
39
|
|
|
30
40
|
Installing the application (as a developer) is simple in the following steps:
|
|
31
41
|
|
|
32
42
|
- Access and Clone this repository
|
|
33
43
|
|
|
34
44
|
```git
|
|
35
|
-
git clone git clone https://github.com/The-Mainstack/
|
|
45
|
+
git clone git clone https://github.com/The-Mainstack/mainstack-design-system.git && cd [repo-name]
|
|
36
46
|
```
|
|
37
47
|
|
|
38
48
|
- Make your forked repo the remote upstream (at origin)
|
|
39
49
|
|
|
40
50
|
```
|
|
41
|
-
git remote add origin https://github.com/The-Mainstack/
|
|
51
|
+
git remote add origin https://github.com/The-Mainstack/mainstack-design-system.git
|
|
42
52
|
```
|
|
43
53
|
|
|
44
54
|
- Navigate into the cloned directory and install dependencies with Yarn
|
|
@@ -60,80 +70,14 @@ cp .env.sample .env
|
|
|
60
70
|
yarn run dev
|
|
61
71
|
```
|
|
62
72
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
> It is important to note that we are using best practicees in this project and all rules set down must be followed
|
|
66
|
-
|
|
67
|
-
- Linting and prettifying rules are already set in the project and they can be accessed in `.prettierrc` and `.eslintrc.json` files respectively
|
|
68
|
-
|
|
69
|
-
- Make sure there are no linting errors before making your push and PRs
|
|
70
|
-
|
|
71
|
-
> Theses linting errors will be displayed in your files and the console accordingly
|
|
72
|
-
|
|
73
|
-
- All react files must be suffixed with `.tsx` extension for effective import/export flow
|
|
74
|
-
|
|
75
|
-
> Bonus: setup format:on save so as to effectively apply the prettier rules
|
|
76
|
-
|
|
77
|
-
- Build the app for production to the `build` folder.
|
|
78
|
-
|
|
79
|
-
```yarn
|
|
80
|
-
yarn run build
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Contributing.
|
|
84
|
-
|
|
85
|
-
- Before contributing, ensure you create a branch for a particular feature you'd want to work on, so we wouldn't be having issues of merge conflict
|
|
86
|
-
- You can create a branch this way — always create a branch off staging;
|
|
87
|
-
|
|
88
|
-
```git
|
|
89
|
-
git checkout staging
|
|
90
|
-
git checkout -b [branch-name]
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
- Make your changes, add them and make your commits
|
|
73
|
+
To run storybook, run the following command:
|
|
94
74
|
|
|
95
|
-
```git
|
|
96
|
-
git commit -m "your message"
|
|
97
75
|
```
|
|
98
|
-
|
|
99
|
-
Write good commit messages as this is important to know the essence of your commit
|
|
100
|
-
|
|
101
|
-
- When you're done with your fixes push to that current branch
|
|
102
|
-
|
|
103
|
-
```git
|
|
104
|
-
git push origin [name-of-branch]
|
|
76
|
+
yarn storybook
|
|
105
77
|
```
|
|
106
78
|
|
|
107
|
-
|
|
108
|
-
- Then make your Pull Request to the `develop` branch
|
|
109
|
-
|
|
110
|
-
## Commit Structure
|
|
111
|
-
|
|
112
|
-
- type: subject e.g body, footer
|
|
113
|
-
|
|
114
|
-
The title consists of the type of the message and subject.
|
|
115
|
-
The type is contained within the title and can be one of these types:
|
|
116
|
-
|
|
117
|
-
- feat: a new feature
|
|
118
|
-
|
|
119
|
-
- fix: a bug fix
|
|
120
|
-
|
|
121
|
-
- docs: changes to documentation
|
|
122
|
-
|
|
123
|
-
- style: formatting, missing semi colons, etc; no code change
|
|
124
|
-
|
|
125
|
-
- refactor: refactoring production code
|
|
126
|
-
|
|
127
|
-
- test: adding tests, refactoring test; no production code change
|
|
128
|
-
|
|
129
|
-
An example of a good commit message
|
|
79
|
+
To Publish to NPM, run the following command:
|
|
130
80
|
|
|
131
81
|
```
|
|
132
|
-
|
|
82
|
+
npm publish --access public
|
|
133
83
|
```
|
|
134
|
-
|
|
135
|
-
## notes
|
|
136
|
-
|
|
137
|
-
- to use env variables in vite, you need to prefix them with `import.meta.env.`. For example, `process.env.REACT_APP_BASE_URL` becomes `import.meta.env.REACT_APP_BASE_URL`.
|
|
138
|
-
|
|
139
|
-
> Happy Hacking !!!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mainstack-design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"format": "prettier src -c --write && pretty-quick --staged",
|
|
10
10
|
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --quiet --fix",
|
|
11
11
|
"ts-error": "tsc",
|
|
12
|
-
|
|
12
|
+
"install:husky": "[ ! -d \"/node_modules/husky/\" ] || husky install",
|
|
13
13
|
"postinstall": "yarn install:husky",
|
|
14
14
|
"prepare": "yarn install:husky",
|
|
15
15
|
"scriptname": "cmd",
|
|
@@ -133,7 +133,7 @@ const CustomToolbar = ({
|
|
|
133
133
|
);
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
const MarkdownEditor = ({
|
|
137
137
|
defaultValue,
|
|
138
138
|
onChange,
|
|
139
139
|
border,
|
|
@@ -244,3 +244,5 @@ export const MarkdownEditor = ({
|
|
|
244
244
|
</Box>
|
|
245
245
|
);
|
|
246
246
|
};
|
|
247
|
+
|
|
248
|
+
export default MarkdownEditor;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
export { default as Button } from "./Button";
|
|
4
|
+
export { default as IconButton } from "./Button/IconButton";
|
|
5
|
+
export { default as Accordion } from "./Accordion";
|
|
6
|
+
export { default as Avatars } from "./Avatars";
|
|
7
|
+
export { default as Chip } from "./controls/Chip";
|
|
8
|
+
export { default as DoubleTab } from "./controls/DoubleTab";
|
|
9
|
+
export { default as Pagination } from "./controls/Pagination";
|
|
10
|
+
export { default as RadioButton } from "./controls/RadioButton";
|
|
11
|
+
export { default as RectangleCheckButton } from "./controls/RectangleCheckButton";
|
|
12
|
+
export { default as RoundCheckButton } from "./controls/RoundCheckButton";
|
|
13
|
+
export { default as Stepper } from "./controls/Stepper";
|
|
14
|
+
export { default as TabMenu } from "./controls/TabMenu";
|
|
15
|
+
export { default as ToggleButton } from "./controls/ToggleButton";
|
|
16
|
+
export * from "./InputFields/SelectInput";
|
|
17
|
+
export { default as Input } from "./InputFields/Input";
|
|
18
|
+
export { default as MarkdownEditor } from "./InputFields/MarkdownEditor";
|
|
19
|
+
export { default as SearchInput } from "./InputFields/SearchInput";
|
|
20
|
+
export { default as TextArea } from "./InputFields/TextArea";
|
|
21
|
+
export { default as UsernameInput } from "./InputFields/UsernameInput";
|
|
22
|
+
export { default as Banner } from "./notifications/Banner";
|
|
23
|
+
export { default as ClickTooltip } from "./notifications/ClickTooltip";
|
|
24
|
+
export { default as HoverTooltip } from "./notifications/HoverTooltip";
|
|
25
|
+
export { default as Snackbar } from "./notifications/Snackbar";
|
|
26
|
+
export { default as Colors } from "./styleGuide/Colors";
|
|
27
|
+
export { default as Tiles } from "./Tiles";
|
|
28
|
+
export { default as Display } from "./Typography/Display";
|
|
29
|
+
export { default as Heading } from "./Typography/Heading";
|
|
30
|
+
export { default as Paragraph } from "./Typography/Paragraph";
|
|
31
|
+
export { default as Subtitle } from "./Typography/Subtitle";
|
|
32
|
+
export { default as FileUploader } from "./Uploader/FileUploader";
|
|
33
|
+
export { default as ImageUploader } from "./Uploader/ImageUploader";
|
package/src/index.ts
ADDED
package/src/pages/Home.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
|
|
3
3
|
import { Box, Text } from "@chakra-ui/react";
|
|
4
|
-
import { MarkdownEditor } from "components
|
|
4
|
+
import { Button, MarkdownEditor } from "components";
|
|
5
5
|
import CountrySelectWrapper from "stories/InputFields/Select/CountrySelectWrapper";
|
|
6
6
|
import PhoneNumberInputWrapper from "stories/InputFields/Select/PhoneNumberInputWrapper";
|
|
7
7
|
import SelectWrapper from "stories/InputFields/Select/SelectWrapper";
|
package/vite.config.ts
CHANGED
|
@@ -5,6 +5,7 @@ import react from "@vitejs/plugin-react";
|
|
|
5
5
|
import viteTsconfigPaths from "vite-tsconfig-paths";
|
|
6
6
|
import svgrPlugin from "vite-plugin-svgr";
|
|
7
7
|
import envCompatible from "vite-plugin-env-compatible";
|
|
8
|
+
import { resolve } from "path";
|
|
8
9
|
|
|
9
10
|
export default defineConfig({
|
|
10
11
|
envPrefix: "REACT_APP_",
|
|
@@ -20,6 +21,9 @@ export default defineConfig({
|
|
|
20
21
|
},
|
|
21
22
|
build: {
|
|
22
23
|
outDir: "build",
|
|
24
|
+
lib: {
|
|
25
|
+
entry: resolve(__dirname, "./src/index.ts"),
|
|
26
|
+
},
|
|
23
27
|
commonjsOptions: {
|
|
24
28
|
transformMixedEsModules: true,
|
|
25
29
|
},
|