@banyan_cloud/roots 1.0.0 → 1.0.2
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/dist/cjs/index.js +36 -23
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +36 -24
- package/dist/esm/index.js.map +1 -1
- package/dist/index.js +36 -24
- package/package.json +12 -4
- package/styles/_colors.scss +136 -0
- package/styles/_index.scss +1 -0
- package/styles/_responsive.scss +41 -0
- package/styles/_utils.scss +47 -0
- package/styles/main.css +103 -0
- package/styles/main.css.map +1 -0
- package/styles/main.scss +115 -0
- package/styles/style-system/ComponentsFormat.stories.mdx +30 -0
- package/styles/style-system/Design.stories.mdx +19 -0
- package/styles/style-system/Style.stories.mdx +110 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
|
2
|
+
|
|
3
|
+
<Meta title='Style System/Component Format' parameters={{ options: { showToolbar: false } }} />
|
|
4
|
+
|
|
5
|
+
# Component Format
|
|
6
|
+
|
|
7
|
+
We are using below format for each components
|
|
8
|
+
|
|
9
|
+
- `componentName.stories.mdx` - Will have Story about the respective component with all possible use cases
|
|
10
|
+
|
|
11
|
+
- `ComponentName.module.scss` - Styles related to perticular components, detail Descriptions is available under <a href='?path=/story/style-system-styles--page'>Styles</a> folders in storybook
|
|
12
|
+
|
|
13
|
+
- `ComponentName.jsx` - JSX stands for JavaScript XML. JSX allows us to write HTML in React. JSX makes it easier to write and add HTML in React.
|
|
14
|
+
Need to import global config and utils if is common in .jsx file, else create a unique config and utils folders to specific components.
|
|
15
|
+
|
|
16
|
+
- `Config` - Folders has data of respective component, eg: used in charts
|
|
17
|
+
|
|
18
|
+
- `Utils` - Unique functions related to the components
|
|
19
|
+
|
|
20
|
+
- `index.js` - It simplifies the imports because `index.js` file which imports the actual component itself, Find the example below:
|
|
21
|
+
|
|
22
|
+
**with Index.js**
|
|
23
|
+
|
|
24
|
+
> import Component from '../Component';
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
**without index.js** If you did not have an index.js file you would have had to do this to acess the file:
|
|
28
|
+
|
|
29
|
+
> import Editable from '../ComponentFolder/ComponetJsx';
|
|
30
|
+
>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
|
2
|
+
|
|
3
|
+
<Meta title='Style System/Designs' parameters={{ options: { showToolbar: false } }} />
|
|
4
|
+
|
|
5
|
+
# Design Descriptions
|
|
6
|
+
|
|
7
|
+
We are using [Figma](https://www.figma.com/) for our creating a Mock-ups/Prototype
|
|
8
|
+
|
|
9
|
+
- [Templates](https://www.designedbyalok.com/links/) - Use cases of all components
|
|
10
|
+
|
|
11
|
+
- [Typography](https://www.figma.com/file/kKEE3r3h9OcHuhs0vnwMG9/Colors-%26-Typography?node-id=4%3A3) - It has all information about typefaces fonts: italic, oblique, and small caps of fonts/styles
|
|
12
|
+
|
|
13
|
+
- [Theme/Color](https://www.figma.com/file/kKEE3r3h9OcHuhs0vnwMG9/Colors-%26-Typography?node-id=0%3A1) - Holds information about Colours of our Brand
|
|
14
|
+
|
|
15
|
+
- [Components List](https://www.figma.com/files/drafts?fuid=1103974723664924599) - Atomic components for building the page
|
|
16
|
+
|
|
17
|
+
- [Assets](https://www.figma.com/file/kKEE3r3h9OcHuhs0vnwMG9/Colors-%26-Typography?node-id=34%3A92) - It has all the icons we are using in entire projects
|
|
18
|
+
|
|
19
|
+
- [Features](https://www.designedbyalok.com/links/) - Prototype of a features
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
|
2
|
+
|
|
3
|
+
<Meta title='Style System/Styles' parameters={{ options: { showToolbar: false } }} />
|
|
4
|
+
|
|
5
|
+
# Style Guidelines
|
|
6
|
+
|
|
7
|
+
We are using [CSS Modules](https://github.com/css-modules/css-modules) in which all class names and animation names are scoped locally by default.
|
|
8
|
+
|
|
9
|
+
**Why we are using [CSS Modules](https://css-tricks.com/css-modules-part-1-need/)**
|
|
10
|
+
|
|
11
|
+
- ` No conflicts` as its Only apply to that component and nothing elsewhere, this approach is designed to fix the `problem of the global scope` in CSS and has `Explicit dependencies`
|
|
12
|
+
|
|
13
|
+
- React lets you split the UI into `independent` and `reusable components`, which allows you to update small parts of your UI without refreshing the page.
|
|
14
|
+
|
|
15
|
+
As React applications grow, the amount of components and layers increases. Simple style changes can have unintended side effects on different parts of a complex page.
|
|
16
|
+
|
|
17
|
+
CSS modules give you the ability to `control your element styles` in a more granular way. They allow you to build different layers of styles while building your application using a modular approach. CSS modules make it easy and fast to achieve tasks such as upgrading buttons, headings, grids, etc.
|
|
18
|
+
|
|
19
|
+
## Naming
|
|
20
|
+
|
|
21
|
+
For local class names `camelCase` naming is recommended, but not enforced. You can still work around `kebab-case` with bracket notation
|
|
22
|
+
|
|
23
|
+
> eg. style['class-name']) or style.className
|
|
24
|
+
|
|
25
|
+
## Steps for writing the styles
|
|
26
|
+
|
|
27
|
+
1. **Style File**
|
|
28
|
+
|
|
29
|
+
- Create a Style file for any component in `componentName.module.scss` format
|
|
30
|
+
- Inport global `style` eg. mixin etc
|
|
31
|
+
|
|
32
|
+
> @import '../../assets/styles/index';
|
|
33
|
+
|
|
34
|
+
- Add Scss as per requirement
|
|
35
|
+
|
|
36
|
+
```cli
|
|
37
|
+
@import '../../assets/styles/index';
|
|
38
|
+
|
|
39
|
+
.container {
|
|
40
|
+
@include flex(row, flex-start, center);
|
|
41
|
+
width: auto;
|
|
42
|
+
height: 3.5rem;
|
|
43
|
+
.breadcrumb-item-title {
|
|
44
|
+
@include flex(row, flex-start, center);
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
font-size: 24px;
|
|
47
|
+
color: #001833;
|
|
48
|
+
}
|
|
49
|
+
.breadcrumb-item {
|
|
50
|
+
@include flex(row, flex-start, center);
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
font-size: 20px;
|
|
53
|
+
color: #003ecb;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. **Jsx file**
|
|
59
|
+
|
|
60
|
+
- Create a `.jsx` file for any component
|
|
61
|
+
- Import styles from css modules
|
|
62
|
+
|
|
63
|
+
> import styles from './componentName.module.css';
|
|
64
|
+
>
|
|
65
|
+
|
|
66
|
+
Note we will write the styles in `.scss` file only but while importing we will import respective `.css` file,
|
|
67
|
+
because we will compile `.scss` file to `.css` file with the help of sass compiler
|
|
68
|
+
|
|
69
|
+
- Import Global class function from `utils` file
|
|
70
|
+
|
|
71
|
+
> import { classes } from '../../utils';
|
|
72
|
+
>
|
|
73
|
+
|
|
74
|
+
- In className, define style in any of these format
|
|
75
|
+
> _style['class-name'])_ or _style.className_.
|
|
76
|
+
|
|
77
|
+
```cli
|
|
78
|
+
import React from 'react';
|
|
79
|
+
import { Breadcrumbs } from '@mui/material';
|
|
80
|
+
import Link from '@mui/material/Link';
|
|
81
|
+
import styles from './Breadcrumbs.module.css';
|
|
82
|
+
import { BreadcrumbSeperatorIcon } from '../../assets/vectors/common';
|
|
83
|
+
import { getSpacedDisplayName, classes } from '../../utils/utils';
|
|
84
|
+
|
|
85
|
+
const BreadCrumbs = ({ crumbs }) => {
|
|
86
|
+
return (
|
|
87
|
+
<div className={classes(styles.container)}>
|
|
88
|
+
<Breadcrumbs
|
|
89
|
+
separator={<BreadcrumbSeperatorIcon width='7' height='9' color='#001833' />}
|
|
90
|
+
aria-label='breadcrumb'>
|
|
91
|
+
{crumbs.map((crumb, index) => {
|
|
92
|
+
return (
|
|
93
|
+
<Link href=' ' key={crumb} underline='none'>
|
|
94
|
+
<span
|
|
95
|
+
className={classes(
|
|
96
|
+
index === 0
|
|
97
|
+
? styles['breadcrumb-item-title']
|
|
98
|
+
: styles['breadcrumb-item']
|
|
99
|
+
)}>
|
|
100
|
+
{getSpacedDisplayName(crumb).replace(/-/g, ' ')}
|
|
101
|
+
</span>
|
|
102
|
+
</Link>
|
|
103
|
+
);
|
|
104
|
+
})}
|
|
105
|
+
</Breadcrumbs>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
```
|