docs: guides section - #717
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Guides section to the Docusaurus docs with interactive/tutorial-style pages demonstrating more complete, real-world patterns (mentions pickers, emoji picker via mentions, and native context menu customization), replacing placeholder guide pages.
Changes:
- Added two new interactive example components for guides: user/channel mention picker and emoji picker.
- Added new MDX guide pages for user/channel mentions and emojis, wired to live interactive examples (Preview/Code).
- Replaced the placeholder “Custom context menu” page with a full native-only guide and removed other placeholder guide stubs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/src/examples/MentionOnlyEditor.tsx | New interactive example implementing @/# mention pickers for the Guides section. |
| docs/src/examples/EmojiEditor.tsx | New interactive example implementing an emoji picker using mention mechanics (:). |
| docs/docs/guides/user-and-channel-mentions.mdx | New guide page explaining how to build user/channel mentions with a picker + live example embed. |
| docs/docs/guides/emojis.mdx | New guide page explaining emoji insertion via mentions + live example embed. |
| docs/docs/guides/custom-context-menu.md | Replaced placeholder with a full guide and example snippet for contextMenuItems (native-only). |
| docs/docs/guides/mention-only-input.md | Removed placeholder stub page. |
| docs/docs/guides/emojis.md | Removed placeholder stub page (replaced by .mdx). |
| docs/docs/guides/chat-input-with-images.md | Removed placeholder stub page. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kacperzolkiewski
left a comment
There was a problem hiding this comment.
LGTM, just three small suggestions
szydlovsky
left a comment
There was a problem hiding this comment.
Just a super small comment
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Kacper Żółkiewski <74975508+kacperzolkiewski@users.noreply.github.com>
Co-authored-by: Kacper Żółkiewski <74975508+kacperzolkiewski@users.noreply.github.com>
Co-authored-by: Mikołaj Szydłowski <9szydlowski9@gmail.com>
19caac3 to
89bb38f
Compare
| // `onPress` fires - so `setMention` would do nothing. Preventing the default | ||
| // mousedown keeps focus in the editor. It's a no-op on native, where tapping a | ||
| // Pressable never steals focus. | ||
| const keepEditorFocused: any = |
There was a problem hiding this comment.
Please provide correct types, any should be avoided
| ]; | ||
|
|
||
| // Each mention kind is styled by its indicator. | ||
| const htmlStyle: HtmlStyle = { |
There was a problem hiding this comment.
Could you move it below component definition, so it sits next to component styles?
|
|
||
| export default function App() { | ||
| const ref = useRef<EnrichedTextInputInstance>(null); | ||
| // The indicator of the mention being edited ('@' | '#'), or null when idle. |
There was a problem hiding this comment.
Doesn't give any value imo, code is self explanatory
| // The indicator of the mention being edited ('@' | '#'), or null when idle. |
| const q = query.toLowerCase(); | ||
| return source.filter(item => item.name.toLowerCase().startsWith(q)); |
There was a problem hiding this comment.
| const q = query.toLowerCase(); | |
| return source.filter(item => item.name.toLowerCase().startsWith(q)); | |
| return source.filter(item => item.name.toLowerCase().startsWith(q.toLowerCase())); |
| onChangeMention={({ indicator: ind, text }: OnChangeMentionEvent) => { | ||
| setIndicator(ind); | ||
| setQuery(text); | ||
| }} |
There was a problem hiding this comment.
Let's create a separate function for this logic
| :::info | ||
|
|
||
| If you want to see the whole code used to build this example, you can find it by switching the tab from `Preview` to `Code`. | ||
|
|
||
| ::: |
There was a problem hiding this comment.
We don't need this explanation, we already have those snippets everywhere in the docs, so user should be familiar with that.
| :::info | |
| If you want to see the whole code used to build this example, you can find it by switching the tab from `Preview` to `Code`. | |
| ::: |
| :::info | ||
|
|
||
| If you want to see the whole code used to build this example, you can find it by switching the tab from `Preview` to `Code`. | ||
|
|
||
| ::: |
There was a problem hiding this comment.
Same here, I think it's redundant
|
|
||
| const hasRangedSelection = !!selection && selection.start !== selection.end; | ||
|
|
||
| const contextMenuItems: ContextMenuItem[] = useMemo( |
There was a problem hiding this comment.
I think useMemo can be omitted. It's just a snippet, what's more nowadays most project should already use react-compiler and manual memoization can be redundant
|
|
||
| :::info | ||
|
|
||
| This is a **native-only** feature (iOS and Android) - which |
There was a problem hiding this comment.
Can we add a video/gif then?
Summary
Added the
Guidessection to the docs. Aside from basic tutorials that taught general features in theRich text formattingsection, this section present 3 tutorials:I tested the same code in an RN app - everything works nicely, the code is portable