slack-blocks-to-jsx 0.3.0 → 0.3.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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "repository": "https://github.com/themashcodee/slack-blocks-to-jsx.git",
13
13
  "license": "MIT",
14
- "version": "0.3.0",
14
+ "version": "0.3.2",
15
15
  "main": "dist/index.js",
16
16
  "module": "dist/index.mjs",
17
17
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Slack Blocks to JSX Documentation
2
2
 
3
3
  ## Overview
4
+
4
5
  The `slack-blocks-to-jsx` package allows you to render Slack blocks in React with styles that closely mimic how they are displayed in Slack. This library converts Slack's block kit components into JSX components, maintaining the visual fidelity and interactive elements.
5
6
 
6
7
  **🚨 Quickly test out the libray on online playground**: https://slack-block-to-jsx-playground.vercel.app/
7
8
 
8
9
  ## Installation
10
+
9
11
  To use this package in your project, install it via npm:
10
12
 
11
13
  ```bash
@@ -21,6 +23,7 @@ yarn add slack-blocks-to-jsx
21
23
  ## Usage
22
24
 
23
25
  ### Importing Styles
26
+
24
27
  Import the necessary CSS file in your entry point to ensure the styles are applied:
25
28
 
26
29
  ```javascript
@@ -28,6 +31,7 @@ import "slack-blocks-to-jsx/dist/style.css";
28
31
  ```
29
32
 
30
33
  ### Using Components
34
+
31
35
  Import the `Message` component from the package and use it to render your Slack blocks:
32
36
 
33
37
  ```javascript
@@ -39,6 +43,7 @@ const blocks = [...]; // your Slack blocks data
39
43
  ```
40
44
 
41
45
  ### Types
46
+
42
47
  For better type safety, you can import the `Block` type:
43
48
 
44
49
  ```javascript
@@ -50,6 +55,7 @@ const blocks: Block[] = [...]; // your Slack blocks data
50
55
  ## Components
51
56
 
52
57
  ### `Message`
58
+
53
59
  This is the main component that renders the entire Slack message. It supports various props to customize the appearance and behavior:
54
60
 
55
61
  - `blocks`: Array of Slack block objects.
@@ -64,6 +70,7 @@ This is the main component that renders the entire Slack message. It supports va
64
70
  - `showBlockKitDebug?`: Show a link to open the message in the Slack Block Kit Builder, for debugging purposes. Defaults to false.
65
71
 
66
72
  ### Block Components
73
+
67
74
  Each Slack block type has a corresponding component:
68
75
 
69
76
  - `Section` (✅ supported)
@@ -72,14 +79,15 @@ Each Slack block type has a corresponding component:
72
79
  - `Context` (✅ supported)
73
80
  - `Actions` (🟨 partially supported)
74
81
  - `File` (❌ not supported yet)
75
- - `Header` (❌ not supported yet)
82
+ - `Header` (✅ supported)
76
83
  - `Input` (🟨 partially supported)
77
84
  - `RichText` (✅ supported)
78
- - `Video` (❌ not supported yet)
85
+ - `Video` (✅ supported)
79
86
 
80
87
  If you want a support of a particular block or element which is not supported yet so please raise a github issue or mail me at codeemash@gmail.com. I will try to push it asap.
81
88
 
82
89
  ## Customization
90
+
83
91
  You can handle custom rendering and interactions using the `hooks` prop in the `Message` component. This allows you to define custom behavior for user mentions, channels, and other interactive elements. You can also override default styling. Here are the classes structure to understand to override any block styling.
84
92
 
85
93
  `.slack_blocks_to_jsx`: Main Wrapper
@@ -90,25 +98,26 @@ You can handle custom rendering and interactions using the `hooks` prop in the `
90
98
  `.slack_blocks_to_jsx__section`: Section Block
91
99
  `.slack_blocks_to_jsx__image`: Image Block
92
100
  `.slack_blocks_to_jsx__context`: Context Block
93
- `.slack_blocks_to_jsx__actions`: Actions Block
101
+ `.slack_blocks_to_jsx__actions`: Actions Block
94
102
  `.slack_blocks_to_jsx__input`: Input Block
95
103
  `.slack_blocks_to_jsx__rich_text`: Rich Text Block
96
104
  `.slack_blocks_to_jsx__rich_text_list_element`: Rich Text Block List Element
97
105
  `.slack_blocks_to_jsx__rich_text_preformatted_element`: Rich Text Block Preformatted Element
98
106
  `.slack_blocks_to_jsx__rich_text_quote_element`: Rich Text Block Element Quote Element
99
- `.slack_blocks_to_jsx__rich_text_section_element`: Rich Text Block Section Element
107
+ `.slack_blocks_to_jsx__rich_text_section_element`: Rich Text Block Section Element
100
108
 
101
109
  ...as so on (all the other classes will be similar too, for example `.slack_blocks_to_jsx__rich_text_section_element_user` for Rich Text Block Section Element User)
102
110
 
103
111
  If you want any other customization so please raise a github issue or mail me at codeemash@gmail.com. I will try to push it asap if it aligns with the library development vision.
104
112
 
105
-
106
113
  ## Development and Contribution
114
+
107
115
  The project is open-source, and contributions are welcome. If you encounter any issues or want to suggest improvements, please file an issue on the GitHub repository:
108
116
 
109
117
  [GitHub Repository Issues](https://github.com/themashcodee/slack-blocks-to-jsx/issues)
110
118
 
111
119
  ## License
120
+
112
121
  The project is licensed under the MIT license, allowing free use, modification, and distribution.
113
122
 
114
123
  ## Support