-
Notifications
You must be signed in to change notification settings - Fork 375
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
feat(examples): MDUI framework #2976
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2976 +/- ##
==========================================
- Coverage 63.39% 63.32% -0.08%
==========================================
Files 565 548 -17
Lines 79457 79302 -155
==========================================
- Hits 50369 50215 -154
- Misses 25695 25712 +17
+ Partials 3393 3375 -18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going in the right direction. But I'm still concerned about having multiple Markdown UI libraries in the same folder doing the same thing. cf #2912 (comment)
I'm wondering if it would be better to have those libraries either in the user namespace or in a dedicated directory until a good one starts showing up.
Like for GitHub, people should generally start building their own libraries in their own namespace, and at some point, if the library is good enough by adoption and usage, we can think about moving it into a more official place.
Additionally, we could use the demo/ui
package to reference all of them and potentially have some kind of poll to rate them as part of the competition process #2753?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as initial version; left a few comments.
Please move it to your personal namespace, as @gfanton suggested. This way we can have multiple md
libraries and time can tell which is the best.
func CodeBlock(code string) string { | ||
return "```go\n" + code + "\n```\n" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you defaulting to Go here?
) | ||
|
||
// Navbar generates a Markdown navigation menu from a map of links | ||
func Navbar(links map[string]string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not encourage map
usage; try to find another way to pass these arguments easily. Probably pairs of strings is the way to go.
func Emoji(name string) string { | ||
emojiMap := map[string]string{ | ||
"smile": "😊", | ||
"heart": "❤️", | ||
"thumbs_up": "👍", | ||
"star": "⭐", | ||
"fire": "🔥", | ||
"check": "✔️", | ||
"cross": "❌", | ||
"warning": "⚠️", | ||
"info": "ℹ️", | ||
"sun": "☀️", | ||
"moon": "🌙", | ||
"rocket": "🚀", | ||
// Add additional emojis as needed | ||
} | ||
if emoji, exists := emojiMap[name]; exists { | ||
return emoji | ||
} | ||
// If emoji is not found, return the name itself as a fallback | ||
return ":" + name + ":" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop this. It takes me the same amount of time to look up an emoji online or in your package; and it will need to be maintained.
Related to #2753
MDUI - Markdown UI Framework for Gno.land
This PR introduces the
mdui
package, a Markdown UI framework designed for rendering clean, reusable UI components in Gno.land realms. The goal is to simplify UI development with a set of pre-defined components that can be easily integrated into any Gno project.Features
The
mdui
package provides several reusable components for building user interfaces quickly and efficiently. Below is a list of the available components along with sample code.1. Navbar
Description: A navigation menu to create a list of links for site navigation.
Sample Code:
2. Heading
Description: Creates a Markdown heading (from H1 to H6).
Sample Code:
3. Button
Description: A clickable button component, implemented as a link in Markdown.
Sample Code:
4. Image
Description: An image component for displaying pictures with optional alt text.
Sample Code:
5. Code Block
Description: A component for rendering code blocks in Markdown.
Sample Code:
6. Divider
Description: A horizontal line divider for separating content.
Sample Code:
7. Paragraph
Description: Formats a block of text as a paragraph.
Sample Code:
8. Quote
Description: A blockquote component for highlighting quoted text.
Sample Code:
9. List (Unordered)
Description: Generates an unordered Markdown list.
Sample Code:
10. List (Ordered)
Description: Generates an ordered Markdown list.
Sample Code:
11. Table
Description: Generates a table with headers and rows for tabular data.
Sample Code:
12. Bold
Description: Formats text in bold.
Sample Code:
13. Italic
Description: Formats text in italic.
Sample Code:
14. Strikethrough
Description: Adds a strikethrough to the text.
Sample Code:
15. Alert
Description: An alert block using Markdown with a specified type (info, warning, danger).
Sample Code:
16. Collapsible
Description: A collapsible section that expands when clicked, using plain Markdown.
Sample Code:
17. Footnote
Description: Generates a footnote reference and definition.
Sample Code:
18. Badge
Description: Creates a badge using the Shields.io service.
Sample Code:
19. Table of Contents
Description: Generates a simple table of contents based on an array of headings.
Sample Code:
20. Keyboard Shortcut
Description: Formats a keyboard shortcut in Markdown using code block style.
Sample Code:
21. Emoji
Description: Adds an emoji to the content using a shortcode.
Sample Code:
22. Blockquote with Citation
Description: Generates a Markdown blockquote with an optional citation.
Sample Code:
23. Badge with Icon
Description: Creates a badge with an icon using Shields.io.
Sample Code:
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description