You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A [React](https://reactjs.org/) component for AsyncAPI specification. It allows you to render the documentation of your asynchronous API provided in the AsyncAPI specification format and validate this specification. You can fully restyle the component using your own styles.
14
+
A official [React](https://reactjs.org/) component for AsyncAPI 2.0 specification. It allows you to render the documentation of your asynchronous API provided in the AsyncAPI specification format and validate this specification. You can fully restyle the component using your own styles.
15
+
16
+
> **CAUTION**: This package only supports AsyncAPI 2.0 specification. If you use 1.x, we recommend that you upgrade to the latest AsyncAPI version using the [Node.js](https://github.com/asyncapi/converter) or [Go](https://github.com/asyncapi/converter-go) converters.
8
17
9
18
## Playground
10
19
11
20
This repository comes in with a [Playground application](https://www.asyncapi.com/asyncapi-react/). Test it to see the component in action and play with it before you use it in your application.
12
21
13
22
You can also run the Playground application locally by following [this](./docs/development/guide.md#install-dependencies) instruction from the development guide.
14
23
15
-
## Usage
24
+
## Prerequisites
16
25
17
-
> **NOTE:** Use React version 16.0.0 or higher and styled-components version 4.0.0 or higher.
26
+
-[`react`](https://github.com/facebook/react/) (version 16.8.0 or higher)
27
+
28
+
## Usage
18
29
19
-
Run this command to install the component:
30
+
Run this command to install the component in your project:
20
31
21
32
```sh
22
33
npm install --save @kyma-project/asyncapi-react
@@ -28,25 +39,29 @@ Check out this simple sandbox application that uses the asyncapi-react component
28
39
29
40
### Props
30
41
31
-
The list of props for the AsyncApi React component includes:
42
+
The list of props for the AsyncAPI React component includes:
The `schema` property is required and contains AsyncAPI specification. Use the `string` type, the [`AsyncApiInterface`](./library/src/types.ts#L13) type, or the [`FetchingSchemaInterface`](./library/src/helpers/fetchSchema.ts#L1) object to fetch the schema from an external resource. For more information on what it contains and what it should look like, read [AsyncAPI Specification](https://github.com/asyncapi/asyncapi#asyncapi-specification).
36
47
37
-
-**theme?: Partial<ThemeInterface\>**
38
-
39
-
The `theme` property is optional and contains styles for specific parts of the AsyncApi component. For information on how to change styles, read the [Theme Modification](./docs/configuration/theme-modification.md) document.
40
-
41
-
> **NOTE:** If you do not pass the [**disableDefaultTheme**](./docs/configuration/config-modification.md) config as `true`, this property is concatenated with the [default theme](./library/src/theme/default.ts)
42
-
43
48
-**config?: Partial<ConfigInterface\>**
44
49
45
-
The `config` property is optional and contains configuration for the AsyncApi component. For more information on the available configuration options, read the [Configuration Modification](./docs/configuration/config-modification.md) document.
50
+
The `config` property is optional and contains configuration for the AsyncAPI component. For more information on the available configuration options, read the [Configuration Modification](./docs/configuration/config-modification.md) document.
46
51
This property is concatenated with the [default configuration](./library/src/config/default.ts).
47
52
48
53
> **NOTE:** The `Partial<T>` type means that every field in the `T` type is optional.
49
54
55
+
### Styles
56
+
57
+
To use default styles based on [SAP Fundamentals](https://sap.github.io/fundamental/), import them as follows:
For information on how to change styles, read the [Style Modification](./docs/configuration/style-modification.md) document.
64
+
50
65
## Development
51
66
52
67
For information on how to set up a development environment, write and run tests, follow the naming and architecture convention defined for the project in the [Development Guide](./docs/development/guide.md).
@@ -62,6 +77,18 @@ If you create a feature request, use the dedicated **Feature request** issue tem
62
77
63
78
If you have a bug to report, reproduce it in an online code editor. For example, use [CodeSandbox](https://codesandbox.io/). Attach the link to the reproduced bug to your issue. Log the bug using the **Bug report** template.
64
79
80
+
## Missing features
81
+
82
+
See the list of features that are still missing in the component:
Copy file name to clipboardExpand all lines: docs/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
This directory contains the following documents that relate to the project:
6
6
7
7
- configuration:
8
-
-[Theme Modification](./configuration/theme-modification.md) describes how to edit a theme of the whole AsyncAPI component or of its specific part.
8
+
-[Style Modification](./configuration/style-modification.md) describes how to edit the styles of the AsyncAPI component.
9
9
-[Configuration Modification](./configuration/config-modification.md) describes the available component configuration options.
10
10
- development:
11
11
-[Development Guide](./development/guide.md) describes how to set up a development environment, write, and run tests. It also contains the naming and architecture convention.
Copy file name to clipboardExpand all lines: docs/configuration/config-modification.md
+44-29Lines changed: 44 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,83 +6,100 @@ Learn how to use various configuration options available in `ConfigInterface`.
6
6
7
7
## Definition
8
8
9
-
See the definition of the object that you must pass to probs to modify the component configuration:
9
+
See the definition of the object that you must pass to props to modify the component configuration:
10
10
11
11
```ts
12
12
interfaceConfigInterface {
13
13
show?: {
14
14
info?:boolean;
15
-
security?:boolean;
16
-
servers?:boolean;
17
15
channels?:boolean;
16
+
servers?:boolean;
18
17
messages?:boolean;
19
18
schemas?:boolean;
20
19
};
21
-
disableDefaultTheme?:boolean;
20
+
expand?: {
21
+
channels?: {
22
+
root?:boolean;
23
+
elements?:boolean;
24
+
};
25
+
servers?: {
26
+
root?:boolean;
27
+
elements?:boolean;
28
+
};
29
+
messages?: {
30
+
root?:boolean;
31
+
elements?:boolean;
32
+
};
33
+
schemas?: {
34
+
root?:boolean;
35
+
elements?:boolean;
36
+
};
37
+
},
22
38
showErrors?:boolean;
39
+
parserOptions?:ParserOptions;
23
40
}
24
41
```
25
42
26
43
-**show?: Partial<ShowConfig>**
27
44
28
-
This field contains configuration responsible for rendering specific parts of the AsyncApi component.
45
+
This field contains configuration responsible for rendering specific parts of the AsyncAPI component.
29
46
All fields are set to `true` by default.
30
47
31
-
-**disableDefaultTheme?: boolean**
48
+
-**expand?: Partial<ExpandConfig>**
32
49
33
-
This field informs whether the forwarded [`ThemeInterface`](../../library/src/theme/theme.ts#L5) should be concatenated with the [default theme](../../library/src/theme/default.ts) or if the AsyncApi component should consider only the forwarded one.
34
-
This field is set to `false` by default.
35
-
36
-
> **NOTE:** When you set this flag to `true`, you must provide definitions of all styles.
50
+
This field contains configuration responsible for expanding specific parts of the AsyncAPI component automatically.
51
+
`root` refers to a root component for specific parts of the AsyncAPI component, and `elements` refers to elements inside the `root` component.
52
+
By default, `expand.channels.root` is set to `true`.
37
53
38
54
-**showErrors?: boolean**
39
55
40
56
This field turns on or off the option displaying validation or parsing errors that show at the top of the component.
41
-
This field is set to `false` by default.
57
+
This field is set to `true` by default.
58
+
59
+
-**parserOptions?: ParserOptions**
60
+
61
+
This field contains configuration for [`asyncapi-parser`](https://github.com/asyncapi/parser). See available options [here](https://github.com/asyncapi/parser-js/blob/master/API.md#parser).
62
+
This field is set to `null` by default.
42
63
43
64
## Examples
44
65
45
-
See exemplary component configuration in JavaScript and TypeScript.
66
+
See exemplary component configuration in TypeScript and JavaScript.
This document describes how you can apply the styles for the AsyncAPI component.
6
+
7
+
## Changing styles
8
+
9
+
In the AsyncApi component, we use pure CSS styling and [`BEM`](http://getbem.com/) methodology. Each HTML tag inside the root component has a unique CSS class in the `asyncapi__{ELEMENT}--{MODIFIER}` format, where:
10
+
11
+
-`{ELEMENT}` is the name of a specific element. Each element name is the concatenation of the names of the elements in which it is located. For example, `asyncapi__channel-header-title` is located in the `header` HTML element of the `channel` element.
12
+
-`{MODIFIER}` is a modifier for `{ELEMENT}`. Very few elements have a modifier. This is usually a badge, button, or similar, generic components.
13
+
14
+
To change styles, create an appropriate class or modify it if you use the [default](../../library/src/styles/fiori.css) style.
15
+
16
+
> **NOTE**: We recommend that you first [copy](../../library/src/styles/fiori.css) the default styles to a separate file and then modify them as you prefer.
0 commit comments