traitify-widgets 3.0.0-alpha.0 → 3.0.0-alpha.1
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 +32 -1
- package/build/traitify.js +1 -1
- package/build/traitify.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ traitify.options.assessmentID = "an assessment id you have generated via a serve
|
|
|
34
34
|
traitify.render("#the-id-of-the-target-you-wish-to-render-to");
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
[Click here](src/index.js) to view other classes available to import, such as
|
|
37
|
+
[Click here](src/index.js) to view other classes available to import, such as `Http`.
|
|
38
38
|
|
|
39
39
|
## Rendering Components
|
|
40
40
|
|
|
@@ -87,6 +87,34 @@ Traitify.render({
|
|
|
87
87
|
});
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### React/JSX
|
|
91
|
+
|
|
92
|
+
- Components used directly must be wrapped by a Container component
|
|
93
|
+
- The Container can wrap multiple components
|
|
94
|
+
- Container accepts these props
|
|
95
|
+
- assessmentID
|
|
96
|
+
- authKey
|
|
97
|
+
- benchmarkID
|
|
98
|
+
- graphql
|
|
99
|
+
- host
|
|
100
|
+
- locale
|
|
101
|
+
- options
|
|
102
|
+
- profileID
|
|
103
|
+
- version
|
|
104
|
+
- If you've set options in a Traitify instance, pass them as props to the Container
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
import traitify, {Components} from "traitify-widgets";
|
|
108
|
+
|
|
109
|
+
export default function Personality({id}) {
|
|
110
|
+
return (
|
|
111
|
+
<Components.Container {...traitify.props()} assessmentID={id}>
|
|
112
|
+
<Components.Results />
|
|
113
|
+
</Components.Container>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
90
118
|
## Events
|
|
91
119
|
|
|
92
120
|
Most components trigger an initialized and updated event. Some components offer additional events. Event handlers must be set before the render command, or they will not be called.
|
|
@@ -115,6 +143,9 @@ Traitify.listener.on("Survey.finished", ({response}) => {
|
|
|
115
143
|
|
|
116
144
|
```
|
|
117
145
|
Traitify.options.locale = "en-us";
|
|
146
|
+
|
|
147
|
+
// Or if the component has already been rendered
|
|
148
|
+
Traitify.updateLocale("en-us");
|
|
118
149
|
```
|
|
119
150
|
|
|
120
151
|
Here is a list of the available locales (`en-us` is the default):
|