Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Generate permalink to specific JSX in REPL demo #149

Merged
merged 5 commits into from
Apr 22, 2020

Conversation

yhatt
Copy link
Owner

@yhatt yhatt commented Apr 22, 2020

As same as Block Kit Builder, REPL demo in v2 will generate a specific permalink to edited JSX. Developer will become easy to do prototyping and sharing through jsx-slack REPL.

jsx: prefix

A generated link will have a hash prefixed with #jsx: such as #jsx:XXXXXXXXX....: The encoded string of compressed JSX data by URL-safe Base64 encoding.

<Blocks>
  <Section>
    Hello, <b>world</b>!
  </Section>
</Blocks>

For example, this JSX generates https://speee-jsx-slack.netlify.app/#jsx:eJyzccrJT84utuNSULAJTk0uyczPA7EVFDxSc3LydRRskuzK84tyUmz0k-wUQYr04aps9KF6AbQEFEU=.

bkb: prefix

By prepending extra prefix bkb: to hash, REPL demo will try to redirect into Block Kit Builder with parameters generated by the converted JSON. e.g. https://speee-jsx-slack.netlify.app/#bkb:modal

It also can use together with jsx: prefix as like https://speee-jsx-slack.netlify.app/#bkb:jsx:eJyzccrJT84utuNSULAJTk0uyczPA7EVFDxSc3LydRRskuzK84tyUmz0k-wUQYr04aps9KF6AbQEFEU=.

It's useful for replacing "Preview in Slack Block Kit Builder" buttons on the documentation. They have URLs for Block Kit Builder generated in advance, but won't reflect the change of jsx-slack so we had to update URL manually when changed behavior of components. We do no longer have to worry the updation of examples by using bkb: prefix.

@yhatt yhatt merged commit 13e3fba into v2 Apr 22, 2020
@yhatt yhatt deleted the v2-demo-generate-permalink branch April 22, 2020 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant