-
Notifications
You must be signed in to change notification settings - Fork 70
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
🖲 [Spike] Add button
role
#1773
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Angus Hollands <[email protected]>
|
} | ||
const node: Link = { | ||
type: 'link', | ||
kind: 'button', |
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.
Buttons feel inherently link-like, i.e. they are not new node types, but more of a styling augmentation.
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.
Thanks for the PR (taking a quick look while in draft!). I am curious if there is going to be conceptually more to myst-ext-button
package in the future? In which case, maybe expanding the package name to cover it?
type: 'link', | ||
kind: 'button', |
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.
Nice - this means there is a good fallback.
Hey @rowanc1 ! Yeah @agoose77 and I were prototyping today and made a lot of pivots!
We very quickly found there's a myriad ways authors may want to style links, and initially borrowed some inspiration from the existing |
Makes sense, forgot about the card package as an analogy. |
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.
Can you provide short user-facing documentation for how this would be used? That would make it easier to understand the implications of role vs. directive etc.
The most common use-case I can imagine for a button is in situations like this:
Some paragraph with a call to action.
[Click me button]
And some more paragraph text.
It sounds like this implementation would be accomplished with the following, is that right?
Some paragraph with a call to action.
{button}`Some call to action text`
And some more paragraph text.
In the context of landing pages you might see one or more buttons next to each other, e.g.
# Title
![A wide hero-style image]()
[Click me button] [Another button]
In this case, is it correct that accomplishing these would be accomplished with:
# Title
![A wide hero-style image]()
{button}`Button text 1` {button}`Button text 2`
Beyond the case for two buttons side-by-side in a landing page-style site, what usecase do you imagine for the "role-like" functionality? E.g. do you imagine users will be doing things like writing some text and {button}`Click Me` putting an inline button like that
?
Finally, just noting that one of the useful features of sphinx-design was that buttons could link to more than just URLs. You could either point to a page / ref / etc, or you could point to a local static file, and it would resolve the links appropriately. I don't think that is critical functionality for an MVP, but just noting it here as we are talking about configuration surface area and what kind of ways we expect people to use the feature
I can engage on a few of these right now (though I will circle back for a lengthier reply). Your examples are how we envisaged using a button — that's the benefit of a role vs directive.1.
Yes, in fact that was one of the things I wanted to do for the AGU demo gallery, but couldn't get the styling right with the constraints at the time.
Yes, this is a useful feature. We borrowed the {button}`Click me <#identifier>`
{button}`#identifier`
{button}`Click me <./document.md>`
{button}`./document.md` To implement this, we also need to extend An uncertainty that I have is whether the existence of two nodes that need "button-like" features implies the need to have {
"type": "button",
"children": [
{
"type": "link",
"url": "..."
}
]
} instead of {
"type": "link",
"kind": "button",
"url": "..."
}
However, I think in the long run I might prefer using annotations e.g. {kind=button}[Click me](#identifier)
{kind=button}[](#identifier)
{kind=button}[Click me](./document.md)
{kind=button}[](./document.md) Footnotes
|
Ref: 2i2c-org/infrastructure#5346
Co-authored-by: Angus Hollands [email protected]
Related PRs