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

🖲 [Spike] Add button role #1773

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

jnywong
Copy link
Contributor

@jnywong jnywong commented Jan 13, 2025

Ref: 2i2c-org/infrastructure#5346

Co-authored-by: Angus Hollands angus@oieltd.com

This PR is a spike for a button role. Sphinx-design has button directives, but these feel under-constrained for mystmd. Furthermore, buttons feel like "special links", and links are inline elements. As a consequence, @jnywong and I decided to implement a button as a special kind of link. We also added a class attribute to the Link node. This will enable primary-secondary styling of buttons in future. This is probably the way that we'll go for all node types — add class and maybe label etc. to every node.
With a recent discussion for adding inline-attributes to roles ({button .secondary}`My button <https://>.` ), this might become a nice UX. This may also be relevant if we support inline attribute annotation of Markdown syntax, e.g. {kind=button}[a button](https://...)
To support sphinx-design, we might consider "upgrading" button directives into block-divs containing {button}`...` in future.
-- @agoose77

Co-authored-by: Angus Hollands <angus@oieltd.com>
Copy link

changeset-bot bot commented Jan 13, 2025

⚠️ No Changeset found

Latest commit: 3a3feea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jnywong jnywong marked this pull request as draft January 13, 2025 11:32
}
const node: Link = {
type: 'link',
kind: 'button',
Copy link
Contributor

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.

@jnywong jnywong changed the title Add button directive Add button role Jan 13, 2025
@jnywong jnywong changed the title Add button role Add button extension Jan 13, 2025
Copy link
Member

@rowanc1 rowanc1 left a 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?

packages/myst-ext-button/CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines +20 to +21
type: 'link',
kind: 'button',
Copy link
Member

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.

@jnywong
Copy link
Contributor Author

jnywong commented Jan 13, 2025

Hey @rowanc1 ! Yeah @agoose77 and I were prototyping today and made a lot of pivots!

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?

We very quickly found there's a myriad ways authors may want to style links, and initially borrowed some inspiration from the existing card component. For this PR, we're going to be focused on a button package specifically and will hopefully converge on extensibility in a future iteration.

@agoose77 agoose77 changed the title Add button extension 🖲 [Spike] Add button role Jan 13, 2025
@rowanc1
Copy link
Member

rowanc1 commented Jan 13, 2025

Makes sense, forgot about the card package as an analogy.

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.

3 participants