Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.

Commit 40f2325

Browse files
jimmyfortinxAxelPeter
authored andcommittedMay 18, 2018
docs: describe components and states (#29)
1 parent 5dec2fd commit 40f2325

File tree

1 file changed

+142
-0
lines changed

1 file changed

+142
-0
lines changed
 

‎README.md

+142
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,148 @@ const app = angular
2121
])
2222
```
2323

24+
## Components
25+
26+
### Themes
27+
28+
Shows a select containing all themes available related to the ui. Themes can be defined through the `ThemesProvider` like this:
29+
30+
```js
31+
ThemesProvider.setThemes([
32+
{
33+
id: "",
34+
name: "None"
35+
},
36+
{
37+
id: "oui-theme-sapphire",
38+
name: "Sapphire"
39+
},
40+
{
41+
id: "oui-theme-diamond",
42+
name: "Diamond"
43+
}
44+
]);
45+
```
46+
47+
### Component status
48+
49+
Shows development status of a component. There is two types of statuses, `cx-design` and `ux`. Depending of the combinaison of both statuses, a status level is chosen between `error`, `warning`, `info` and `success`.
50+
51+
Statuses are configured through the `ComponentStatusProvider` like this:
52+
53+
```js
54+
const CX_DESIGN_LEVELS = {
55+
error: ["deprecated"],
56+
warning: ["none"],
57+
info: ["partial"],
58+
success: ["complete"]
59+
};
60+
61+
const UX_LEVELS = {
62+
error: ["prototype"],
63+
warning: ["beta"],
64+
info: ["rc"],
65+
success: ["complete"]
66+
};
67+
68+
ComponentStatusProvider.setReadmeUrl("#!/documentation/component-status");
69+
ComponentStatusProvider.setFindMessageTypeFunc((level, cxDesign, ux) =>
70+
includes(CX_DESIGN_LEVELS[level], cxDesign) || includes(UX_LEVELS[level], ux)
71+
);
72+
```
73+
74+
Once configuration is done, user can write this to show the component status:
75+
76+
```html
77+
<component-status cx-design="partial" ux="beta"></component-status>
78+
```
79+
80+
### Versions
81+
82+
**(DEPRECATED)** This component should not be used anymore and is not maintained anymore.
83+
84+
## States
85+
86+
### root
87+
88+
When user open the website without any routes, he will be redirected to the `showcase.documentation` state.
89+
90+
### showcase
91+
92+
State used as a base to all routes that needs to show documentation menus. Sub states will automatically populate menus.
93+
94+
```js
95+
$stateProvider
96+
.state("showcase.ovh-ui-kit", {
97+
url: "/ovh-ui-kit",
98+
[...]
99+
});
100+
```
101+
102+
#### First level children states
103+
104+
They can use multiple attributes to populate menus and write better texts. Those items will appear on the top menu.
105+
106+
- **friendlyName**: Well formatted name that appears in the top menu
107+
- **groupName**: Name that appears as header of side menu
108+
- **weight**: Weight of an item. By default, items have 0 as weight. Items are rendered from left to right (bigger weight to smaller weight) and sorted alphabetically from a to z when numbers are equals
109+
- **groups**: List of groups used to group children together in side menu
110+
111+
```js
112+
$stateProvider
113+
.state("showcase.oui-angular", {
114+
url: "/oui-angular",
115+
friendlyName: "Components",
116+
groupName: "oui-angular components",
117+
redirectTo: "showcase.oui-angular.introduction",
118+
template: "<ui-view></ui-view>",
119+
weight: 9000,
120+
groups: {
121+
basic: {
122+
name: "Basic",
123+
weight: 9000
124+
},
125+
form: {
126+
name: "Form",
127+
weight: 8000
128+
}
129+
}
130+
});
131+
```
132+
133+
#### Second level children states
134+
135+
They can use multiple attributes to populate menus write better texts. Those items will appear on the side menu.
136+
137+
- **friendlyName**: Well formatted name that appears in the side menu
138+
- **group**: Group key that correspond to first level state group to get group details
139+
- **weight**: Weight of an item inside its group. By default, items have 0 as weight. Items are rendered from top to bottom (bigger weight to smaller weight) and sorted alphabetically from a to z when numbers are equals
140+
141+
```js
142+
$stateProvider
143+
.state("showcase.oui-angular.button", {
144+
url: "/button",
145+
friendlyName: "Button",
146+
template: buttonTemplate,
147+
group: "basic",
148+
weight: 3000
149+
})
150+
```
151+
152+
## States utilities
153+
154+
### redirectTo
155+
156+
When a state is declared, a new attribute can be used to automatically redirect the user to another state.
157+
158+
```js
159+
$stateProvider
160+
.state("showcase", {
161+
redirectTo: "showcase.documentation",
162+
template: "<showcase-ui></showcase-ui>"
163+
})
164+
```
165+
24166
## Contribute
25167

26168
Please refer to [CONTRIBUTING](CONTRIBUTING.md).

0 commit comments

Comments
 (0)
This repository has been archived.