Skip to content

Commit

Permalink
fix: ✏️ fix readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
themashcodee committed Jul 11, 2024
1 parent d6a195f commit 99de837
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"repository": "https://github.com/themashcodee/slack-blocks-to-jsx.git",
"license": "MIT",
"version": "0.3.8",
"version": "0.3.9",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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.

**🚨 Quickly test out the libray on online playground**: https://slack-block-to-jsx-playground.vercel.app/
**🚨 Quickly test out the library on online playground**: https://slack-block-to-jsx-playground.vercel.app/

## Installation

Expand Down Expand Up @@ -72,7 +72,7 @@ This is the main component that renders the entire Slack message. It supports va
- atChannel?: () = ReactNode
- atEveryone?: () = ReactNode
- atHere?: () = ReactNode
- emoji?: (text:string) => string
- emoji?: (name:string) => ReactNode | "fallback" (return "fallback" if you can't handle the emoji)
- date?: (data: { timestamp: string; format: string; link: string | null; fallback: string; }) => ReactNode;
- `data?`: optionally pass an array or users, channels and user groups to automatically be replaced with the user, channel and user group mentions.
- `showBlockKitDebug?`: Show a link to open the message in the Slack Block Kit Builder, for debugging purposes. Defaults to false.
Expand Down

2 comments on commit 99de837

@StephenTangCook
Copy link
Contributor

@StephenTangCook StephenTangCook commented on 99de837 Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@themashcodee I'll admit I don't love this solution. The hardcoded "fallback" is a bit hacky. Here are some suggestions for other methods to achieve this:

  1. Provide a fallback argument which is a function (name:string) => ReactNode, which the caller has the option to use as needed. This function is the default behavior for the hook.
  2. Returning null indicates failure and should rely on the default behavior. Returning "" empty string means the caller does not want to show anything for the emoji.

Personally, I prefer #1. What do you think?

@themashcodee
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.